Free all the records in this list.
@param recordOwner Free records that have this recordowner (if null, free all records).
335869
public void free(RecordOwner recordOwner)
    {
        if (m_ScreenRecord != null)
            if ((recordOwner == null) || (m_ScreenRecord.getRecordOwner() == recordOwner))
        {
            m_ScreenRecord.free();  // Delete the screen fields
            m_ScreenRecord = null;
        }

        while (this.size() > 0)
        {
            Record record = (Record)this.elementAt(0);
            if ((recordOwner == null) || (record.getRecordOwner() == recordOwner))
                record.free();
            else
                this.removeRecord(record);  // Remove the query from this list
        } 
        this.removeAllElements();
    }
1364947
public void setOwner(ListenerOwner owner)
    {
        super.setOwner(owner);
        if (owner != null) if (this.getOwner().getState() == false)
            m_mergeRecord.getTable().removeTable(m_subRecord.getTable()); // If this is off initially, take the table out of the loop
    }
337724
public void setOwner(ListenerOwner owner)
    {
        super.setOwner(owner);
        if (owner != null)
        {
            Record recUserInfo = this.getOwner();
            RecordOwner recordOwner = recUserInfo.getRecordOwner();
            Record recUserScreenRecord = (Record)recordOwner.getScreenRecord();
            // This will flag the password as changed:
            recUserScreenRecord.getField(UserScreenRecord.NEW_PASSWORD_1).addListener(new ChangeOnChangeHandler(recUserInfo.getField(UserInfo.PASSWORD), true));
            recUserScreenRecord.getField(UserScreenRecord.NEW_PASSWORD_2).addListener(new ChangeOnChangeHandler(recUserInfo.getField(UserInfo.PASSWORD), true));
        }
    }
414751
public void setOwner(ListenerOwner owner)
    {
        super.setOwner(owner);
        if (owner != null)
        {
            if (m_fldTarget != null)
                if (m_fldTarget.getRecord() != this.getOwner().getRecord())
                    m_fldTarget.addListener(new FieldRemoveBOnCloseHandler(this));      // Not same file, if target file closes, remove this listener!
            if (this.getFieldTarget() != null)
                if (!(this.getFieldTarget().isVirtual()) && (!(this.getFieldTarget().getRecord() instanceof ScreenRecord)))
                    if (this.respondsToMode(DBConstants.READ_MOVE) == true)
                        if (this.respondsToMode(DBConstants.INIT_MOVE) == true)
            {   // This is a performance issue if the field I'm updating is connected to a file
                this.setRespondsToMode(DBConstants.READ_MOVE, false);   // Usually, you only want to recompute on screen change
                this.setRespondsToMode(DBConstants.INIT_MOVE, false);   // Usually, you only want to recompute on screen change
            }
        }
    }
400847
public void setOwner(ListenerOwner owner)
    {
        super.setOwner(owner);
        if (owner == null)
            return;
        if (m_recordMain != null)
        {   // If they are using the main record, then make sure the key area is correct.
            ReferenceField fieldThisRecord = this.getOwner().getReferenceField(m_recordMain);
            if (fieldThisRecord != null)
                if (fieldThisRecord.getReferenceRecord(null, false) == null)
                    fieldThisRecord.setReferenceRecord(m_recordMain);   // Make sure these are linked
            this.getOwner().setKeyArea(fieldThisRecord);
            // Listen carefully:
            // If the main record belongs to another screen and the screen is closed,
            // do not change the sub-field.
            if (fieldThisRecord != null)
                if (this.getOwner().getRecordOwner() != null)
                    if (m_recordMain.getRecordOwner() != null)
                        if (this.getOwner().getRecordOwner() != m_recordMain.getRecordOwner())
                            fieldThisRecord.addListener(new InitIfSubFieldHandler(null));
        }
        else if (m_fldThisFile == null)
        {
            if (m_strKeyName == null)
                m_strKeyName = this.getOwner().getKeyArea().getKeyName();
            if (m_strKeyName != null)
            {
            	this.getOwner().setKeyArea(m_strKeyName);
            	if (m_fldMainFile != null)
            		m_fldThisFile = this.getOwner().getKeyArea().getField(0);
            	if (m_fldMainFile2 != null)
            		m_fldThisFile2 = this.getOwner().getKeyArea().getField(1);
            	if (m_fldMainFile3 != null)
            		m_fldThisFile3 = this.getOwner().getKeyArea().getField(2);
            }
        }
    }
335933
public void setOwner(ListenerOwner owner)
    {
        super.setOwner(owner);
        if (this.getOwner() != null)
            this.syncBehaviorToRecord(this.getOwner().getRecord().getField(m_iMainFilesFieldSeq));  // Init now
    }
970390
public void setOwner(ListenerOwner owner)
    {
        super.setOwner(owner);
        if (this.getOwner() != null)
        {
            InitFieldHandler behavior = (InitFieldHandler)this.getOwner().getListener(InitFieldHandler.class.getName());
            if (this.getOwner().getRecord().getEditMode() == DBConstants.EDIT_CURRENT)
                behavior = null;    // Special case - if there is a current record, make sure initonce works.
            if (behavior != null)
                this.setFirstTime(false);  // If InitFieldHandler already set the initial value, don't set the first time.
        }
    }
415003
public void setOwner(ListenerOwner owner)
    {
        super.setOwner(owner);
        if (this.getOwner() != null)
            if (m_fldTarget == null)
                if (m_fsTarget != null)
                    m_fldTarget = this.getOwner().getField(m_fsTarget);
    }
1231980
public void free(final int counterId)
    {
        final int recordOffset = metaDataOffset(counterId);

        metaDataBuffer.putLong(
            recordOffset + FREE_FOR_REUSE_DEADLINE_OFFSET, epochClock.time() + freeToReuseTimeoutMs);
        metaDataBuffer.putIntOrdered(recordOffset, RECORD_RECLAIMED);
        freeList.addInt(counterId);
    }
635385
public void setOwner(ListenerOwner owner)
    {
        super.setOwner(owner);
        if (owner != null) if (m_recordToSync != null)
            m_recordToSync.addListener(new FileRemoveBOnCloseHandler(this));
    }
537652
public void free()
    {
        int iOldEditMode = 0;
        if (m_record != null) // First, release the record for this table
        {
            iOldEditMode = this.getRecord().getEditMode();
            this.getRecord().setEditMode(iOldEditMode | DBConstants.EDIT_CLOSE_IN_FREE);    // This is a cludge... signals tables that this is the last close()!
        }
        this.close();
        if (m_record != null) // First, release the record for this table
            this.getRecord().setEditMode(iOldEditMode);   // This is a cludge... signals tables that this is the last close()!

        super.free(); // Set the record's table reference to null.

        if (m_database != null)
            m_database.removeTable(this);
        m_database = null;
        m_dataSource = null;
        m_objectID = null;
    }
55301
public void setOwner(ListenerOwner owner)
    {
        if (owner != null)
        if (m_fldDest == null)
            if (fieldName != null)
                m_fldDest = ((BaseField)owner).getRecord().getField(fieldName);
        super.setOwner(owner);
    }
732536
public void free()
    {
        Record recUserRegistration = (Record)m_systemRecordOwner.getRecord(UserRegistrationModel.USER_REGISTRATION_FILE);
        if (recUserRegistration != null)
        {
            for (UserProperties regKey : m_htRegistration.values())
            {
                regKey.free();  // Remove yourself                
            }
            recUserRegistration.free();
            recUserRegistration = null;
        }

        Record recUserInfo = (Record)this.getUserInfo();
        if (recUserInfo != null)
        {
            if (recUserInfo.isModified(false))
            {
                try   {
                    if (recUserInfo.getEditMode() == Constants.EDIT_ADD)
                        recUserInfo.add();
                    else
                        recUserInfo.set();
                } catch (DBException ex)    {
                    ex.printStackTrace();
                }
            }
            recUserInfo.free();
            recUserInfo = null;
        }

        super.free();
    }
346075
public void setOwner(ListenerOwner owner)
    {
        super.setOwner(owner);
        if (owner != null)
        {
            if (m_converterSource == null)
                m_converterSource = this.getOwner();
            if (m_converterDest != null)
                if (m_converterDest.getField() != null)
                    if (m_converterSource.getField() == this.getOwner())    // Always!
                        if (((BaseField)m_converterDest.getField()).getRecord() != this.getOwner().getRecord())
            { // Not same file, if target file closes, remove this listener!
                ((BaseField)m_converterDest.getField()).getRecord().addListener(new FileRemoveBOnCloseHandler(this));
            }
        }
        else if (m_bFreeChainedConverters)
        {   // Free all the converters in the chain
            while ((m_converterDest != null) && (m_converterDest != m_converterDest.getField()))
            {
                Converter converterNext = null;
                if (m_converterDest instanceof FieldConverter)
                    converterNext = ((FieldConverter)m_converterDest).getNextConverter();
                m_converterDest.free();
                m_converterDest = converterNext;
            }
            while ((m_converterSource != null) && (m_converterSource != m_converterSource.getField()))
            {
                Converter converterNext = null;
                if (m_converterSource instanceof FieldConverter)
                    converterNext = ((FieldConverter)m_converterSource).getNextConverter();
                m_converterSource.free();
                m_converterSource = converterNext;
            }
        }
    }
1046314
public void setOwner(ListenerOwner owner)
    {
        super.setOwner(owner);
        if (this.getOwner() != null)
            this.getOwner().setOpenMode(this.getOwner().getOpenMode() | DBConstants.OPEN_REFRESH_AND_LOCK_ON_CHANGE_STRATEGY);    // Make sure keys are updated before sync
    }
895472
public Record makeReferenceRecord(RecordOwner recordOwner)
    {
        ContactTypeField fldContactType = this.getContactTypeField();
        if (fldContactType == null)
            return null;
        if (this.getRecord().getRecordOwner() != null)
            recordOwner = this.getRecord().getRecordOwner();
        ContactType recContactType = (ContactType)fldContactType.getReferenceRecord();
        recContactType = (ContactType)fldContactType.getReference();
        if (m_recVendor == null)
        {
            String strRecordName = "Vendor";
            m_recVendor = (Company)recContactType.makeRecordFromRecordName(strRecordName, recordOwner);
            if (m_recVendor != null)
                VENDOR_CONTACT_TYPE_ID = recContactType.getContactType(m_recVendor).getField(ContactType.ID).toString();
        }
        if (m_recProfile == null)
        {
            String strRecordName = "Profile";
            m_recProfile = (Company)recContactType.makeRecordFromRecordName(strRecordName, recordOwner);
            if (m_recProfile != null)
                PROFILE_CONTACT_TYPE_ID = recContactType.getContactType(m_recProfile).getField(ContactType.ID).toString();
        }
        recContactType = (ContactType)fldContactType.getReference();
        String strHeaderRecordName = null;
        if (recContactType != null)
            strHeaderRecordName = recContactType.getField(ContactType.CODE).toString();
        if ((strHeaderRecordName == null) || (strHeaderRecordName.length() == 0))
            strHeaderRecordName = recordOwner.getProperty(fldContactType.getFieldName());
        Record record = m_recVendor;
        if (strHeaderRecordName != null)
        {    // Always
            if ("Vendor".equalsIgnoreCase(strHeaderRecordName))
                record = m_recVendor;
            else if ("Profile".equalsIgnoreCase(strHeaderRecordName))
                record = m_recProfile;
        }
        return record;
    }
676768
public void removeLockedObjectOwner( String owner ) {

        try {
            if (this.owner != null) {
                int size = this.owner.length;
                for (int i = 0; i < size; i++) {
                    // check every owner if it is the requested one
                    if (this.owner[i].equals(owner)) {
                        // remove the owner
                        size -= 1;
                        String[] newLockedObjectOwner = new String[size];
                        for (int j = 0; j < size; j++) {
                            if (j < i) {
                                newLockedObjectOwner[j] = this.owner[j];
                            } else {
                                newLockedObjectOwner[j] = this.owner[j + 1];
                            }
                        }
                        this.owner = newLockedObjectOwner;

                    }
                }
                if (this.owner.length == 0) {
                    this.owner = null;
                }
            }
        } catch (ArrayIndexOutOfBoundsException e) {
            LOGGER.error(e, new TextI18n("LockedObject.removeLockedObjectOwner()"));
        }
    }