Class IndexedFileSingleProcess

All Implemented Interfaces:
IPersistence, AbstractDataObject, ICBLBeanNGroup, ICBLContainer, IFieldContainer, ISMBean, ISMDataType
Direct Known Subclasses:
CicsIndexedFile, IndexedFile

public abstract class IndexedFileSingleProcess extends AbstractBasePersistence
  • Field Details

    • _CurrentIndex

      protected int _CurrentIndex
  • Constructor Details

    • IndexedFileSingleProcess

      public IndexedFileSingleProcess()
    • IndexedFileSingleProcess

      public IndexedFileSingleProcess(BaseService owner)
    • IndexedFileSingleProcess

      public IndexedFileSingleProcess(BaseService owner, String dbProperties)
  • Method Details

    • dispose

      public void dispose()
      ~IndexedFileSingleProcess() { dispose(false); }
    • dispose

      protected void dispose(boolean disposing)
    • IsFileopen

      public boolean IsFileopen()
    • retrieveOpenMode

      public int retrieveOpenMode()
      Specified by:
      retrieveOpenMode in class AbstractBasePersistence
    • assignOptimiseForDeleteOperation

      public void assignOptimiseForDeleteOperation(boolean optimiseForDeleteOperation)
    • assignRecordKey

      public void assignRecordKey(AbstractCBLField recordKey)
      Sets the field for indexing records in the file. The primary key must be unique for each record.
      Parameters:
      name - ="recordKey - Key field
    • assignSQLTableName

      public void assignSQLTableName(String tableName)
      This method does nothing! It is provided to simply moving between ISQLBean and Indexed file architecture
      Parameters:
      tableName -
    • retrieveRecordKey

      public ISMObject retrieveRecordKey()
      for internal use only
      Returns:
    • assignRecordKey

      public void assignRecordKey(AbstractCBLField recordKey, boolean allowDuplicates)
      Sets the field for indexing records in the file. The primary key can be set to allow duplicate records.
      Parameters:
      recordKey - - Key field
      allowDuplicates - - Allow duplicate records or not
    • getRecordKey

      public AbstractCBLField getRecordKey()
      Returns the index field.
    • assignAlternateKey

      public void assignAlternateKey(AbstractCBLField alternateKey)
      Sets the alternate field for indexing records in the file. The defined alternate is treated as not unique.
      Parameters:
      alternateKey - - Alternate keyValue field
    • assignAlternateKey

      public void assignAlternateKey(AbstractCBLField alternateKey, boolean allowDuplicates)
      Sets the alternate field for indexing records in the file. The alternate keyValue might allow duplication.
      Parameters:
      alternateKey - - Alternate keyValue field
      allowDuplicates - - Allow duplicate records or not
    • setAlternateKey

      public void setAlternateKey(AbstractCBLField[] alternateKeys)
      Sets the alternate fields for indexing records in the file. The defined alternate is treated as not unique.
      Parameters:
      alternateKeys - - Alternate keyValue field
      isUnique - - Allow duplicate records or not
    • setAlternateKey

      public void setAlternateKey(AbstractCBLField[] alternateKeys, boolean allowDuplicates)
      Sets the alternate fields for indexing records in the file. The alternate keys might allow duplication.
      Parameters:
      alternateKeys - - Alternate keyValue field
      allowDuplicates - - Allow duplicate records or not
    • open

      public int open(int openMode)
      Opens the specified file for Reading/writing records.
      Specified by:
      open in class AbstractBasePersistence
      Parameters:
      openMode - - An IndexedFileSingleProcess can be opened in the following modes; 1. INPUT(1) - Reads all the records from the specified file and index according to the specified keyValue. If the file does not exist then exception is thrown. 2. OUTPUT(2) - New file is created or if exists then overwritten with the populated records. 3. I/O(3) or Extend(4) - Reads all the records (if file exists) and indexes. Writes all the records while closing the file.
    • openCics

      public int openCics(int openMode)
    • close

      public int close()
      Closes the file and writes all the indexed records to the specified file if open mode allows writing.
      Specified by:
      close in class AbstractBasePersistence
      Returns:
      0 on success
    • nextRecord

      public int nextRecord()
      Reads the next record into memory. If the file access mode is SEQUENTIAL or DYNAMIC then records are navigated sequentially. Otherwise the records that have an index greater than or equal to the keyValue value are filtered and each record is Read into memory on each call.
      Specified by:
      nextRecord in class AbstractBasePersistence
      Returns:
      true on success otherwise, false
    • prevRecord

      public int prevRecord()
      Reads the prev record into memory. If the file access mode is SEQUENTIAL or DYNAMIC then records are navigated sequentially. Otherwise the records that have an index less than or equal to the keyValue value are filtered and each record is Read into memory on each call.
      Specified by:
      prevRecord in class AbstractBasePersistence
      Returns:
      true on success otherwise, false
    • readRecord

      public int readRecord()
      Reads the next record into memory if access mode is SEQUENTIAL otherwise, it tries to find a record with key value.
      Specified by:
      readRecord in class AbstractBasePersistence
      Returns:
      true on success otherwise, false
    • deleteRecord

      public int deleteRecord()
      Deletes the current record if access mode is SEQUENTIAL otherwise, tries to delete the record with keyValue value.
      Specified by:
      deleteRecord in class AbstractBasePersistence
      Returns:
      true on success otherwise, false
    • deleteFile

      public boolean deleteFile()
      Deletes the current record if access mode is SEQUENTIAL otherwise, tries to delete the record with keyValue value.
      Returns:
      true on success otherwise, false
    • clear

      public int clear()
      Clears all the indexed records.
      Specified by:
      clear in class AbstractBasePersistence
      Returns:
      true on success otherwise, false
    • insertRecord

      public int insertRecord()
      Indexes and inserts the current record into memory table.
      Specified by:
      insertRecord in class AbstractBasePersistence
      Returns:
      when successful it returns IPersistence.STATUS_SUCCESS
    • updateRecord

      public int updateRecord()
      updates the record with specified keyValue to current values.
      Specified by:
      updateRecord in class AbstractBasePersistence
      Returns:
      when successful it returns IPersistence.STATUS_SUCCESS
    • seekRecord

      public int seekRecord(AbstractCBLField searchKey)
      Implements the COBOL START command related to IndexedFileSingleProcess, searching for keys matching the condition CONDITION_TYPE_GREATER_OR_EQUALS
      Parameters:
      searchKey - -
    • seek

      public int seek(AbstractCBLField key, int conditionType)
      Go to the record identified by key Condition type is one of : ACMBasePersistence.CONDITION_TYPE_NO_CONDITION = 0; ACMBasePersistence.CONDITION_TYPE_EQUALS = 1; ACMBasePersistence.CONDITION_TYPE_GREATER = 2; ACMBasePersistence.CONDITION_TYPE_LESS = 3; ACMBasePersistence.CONDITION_TYPE_GREATER_OR_EQUALS = 4; ACMBasePersistence.CONDITION_TYPE_LESS_OR_EQUALS = 5;
    • seekRecord

      public int seekRecord(ISMObject searchKey, int conditionType)
      Implements the COBOL START command related to IndexedFileSingleProcess.
      Parameters:
      searchKey - -
      conditionType - -
    • resetseek

      public void resetseek()
    • assignLock

      public void assignLock(boolean on)
      Locks or unlocks the file for Reading/writing access.
      Overrides:
      assignLock in class AbstractBasePersistence
      Parameters:
      on - - Set lock on or off.
    • flush

      public void flush()
    • isInsertSingleRecordMode

      protected boolean isInsertSingleRecordMode()
      this method is designed to be overwritten by IndexedFiles
    • GenerateGUID

      protected String GenerateGUID()
    • getFullFileName

      public String getFullFileName()
    • getDataDirectory

      public static final String getDataDirectory()
      Set-up the Input/Output directory for creation of sequential files. if running in a web-environment (WEB-INF somewhere in the path) The method needs "softwaremining.properties" file somewhere it its path.
      Returns:
      if WEB-INF is somewhere in the path then it absolute path for "WEB-INF/out" if WEB-INF is not anywhere in the path - then it returns "";
    • isUseRecSeqDataFiles

      public boolean isUseRecSeqDataFiles()
      indicates whether the underlying data-file is RECORD-SEQUENTIAL (no CR/LF) or Line-Sequential
      Returns:
    • assignUseRecSeqDataFiles

      public void assignUseRecSeqDataFiles(boolean useRecSeqDataFiles)
      Used to indicate whether the underlying data-file is RECORD-SEQUENTIAL (no CR/LF) or Line-Sequential
      Parameters:
      useRecSeqDataFiles -
    • assignDelegateDAO

      public void assignDelegateDAO(IndexedFileSingleProcess delegateDAO)
      This method does not do anything for IndexedFiles. But it is provided just in case we need to change Super-class for a Persistence.DAO from IndexedFiles to SQLWrapper.
    • assignRecordsAreFixedLength

      @Deprecated public void assignRecordsAreFixedLength(boolean fixedLengthRecord)
      Deprecated.
      This is a stub method, and does not perform anything. Fixed-Length Records not applicable to indexed files.
      Parameters:
      fixedLengthRecord -