Adds a historical record.

@param historicalRecord The record to add.
@return True if the record was added.
556776
private boolean addHisoricalRecord(HistoricalRecord historicalRecord) {
        synchronized (mInstanceLock) {
            final boolean added = mHistoricalRecords.add(historicalRecord);
            if (added) {
                mHistoricalRecordsChanged = true;
                pruneExcessiveHistoricalRecordsLocked();
                persistHistoricalData();
                sortActivities();
            }
            return added;
        }
    }
1220936
protected void addToHistory(V obj)
    {
        if(maxHistory < 1)
            return;
        if(history == null)
            if (maxHistory != Integer.MAX_VALUE)//we probably set it to a reasonable value
            {
                try
                {
                    history = new ArrayDeque<V>(maxHistory);
                }
                catch (Exception ex)
                {
                    //what is we cause one of the many OOM exceptiosn b/c initial history was too big?
                    //AKA we googed on being helpful
                    history = new ArrayDeque<V>();
                }
            }
            else
                history = new ArrayDeque<V>();
        if(history.size() == maxHistory)//make room
            history.removeFirst();
        history.add(obj);
    }
430352
public boolean addRecordOwner(RecordOwnerParent recordOwner)
    {
    	if (recordOwner instanceof BasePanel)
    		return false;		// Panels have their own owner hierarchy - Don't need to manage them
    	if (m_recordOwnerCollection == null)
    		m_recordOwnerCollection = new RecordOwnerCollection(this);
    	return m_recordOwnerCollection.addRecordOwner(recordOwner);
    }
1209238
def history_add(self, value):
        
        if self._history_max_size is None or self.history_len() < self._history_max_size:
            self._history.append(value)
        else:
            self._history = self._history[1:] + [value]
562760
public boolean update(String tableName, Record record) {
		return update(tableName, config.dialect.getDefaultPrimaryKey(), record);
	}
1234007
public synchronized void
addRR(Record r) {
	if (rrs.size() == 0) {
		safeAddRR(r);
		return;
	}
	Record first = first();
	if (!r.sameRRset(first))
		throw new IllegalArgumentException("record does not match " +
						   "rrset");

	if (r.getTTL() != first.getTTL()) {
		if (r.getTTL() > first.getTTL()) {
			r = r.cloneRecord();
			r.setTTL(first.getTTL());
		} else {
			for (int i = 0; i < rrs.size(); i++) {
				Record tmp = (Record) rrs.get(i);
				tmp = tmp.cloneRecord();
				tmp.setTTL(r.getTTL());
				rrs.set(i, tmp);
			}
		}
	}

	if (!rrs.contains(r))
		safeAddRR(r);
}
1088323
public void addHistory(History history) {
        if (disableHistoryWrite) {
            return;
        }
        PreparedStatement statement = null;

        try (Connection sqlConnection = sqlService.getConnection()) {
            statement = sqlConnection.prepareStatement("INSERT INTO " + Constants.DB_TABLE_HISTORY +
                                                           "(" + Constants.GENERIC_PROFILE_ID + "," + Constants.GENERIC_CLIENT_UUID + "," +
                                                           Constants.HISTORY_CREATED_AT + "," + Constants.GENERIC_REQUEST_TYPE + "," +
                                                           Constants.HISTORY_REQUEST_URL + "," + Constants.HISTORY_REQUEST_PARAMS + "," +
                                                           Constants.HISTORY_REQUEST_POST_DATA + "," + Constants.HISTORY_REQUEST_HEADERS + "," +
                                                           Constants.HISTORY_RESPONSE_CODE + "," + Constants.HISTORY_RESPONSE_HEADERS + "," +
                                                           Constants.HISTORY_RESPONSE_CONTENT_TYPE + "," + Constants.HISTORY_RESPONSE_DATA + "," +
                                                           Constants.HISTORY_ORIGINAL_REQUEST_URL + "," + Constants.HISTORY_ORIGINAL_REQUEST_PARAMS + "," +
                                                           Constants.HISTORY_ORIGINAL_REQUEST_POST_DATA + "," + Constants.HISTORY_ORIGINAL_REQUEST_HEADERS + "," +
                                                           Constants.HISTORY_ORIGINAL_RESPONSE_CODE + "," + Constants.HISTORY_ORIGINAL_RESPONSE_HEADERS + "," +
                                                           Constants.HISTORY_ORIGINAL_RESPONSE_CONTENT_TYPE + "," + Constants.HISTORY_ORIGINAL_RESPONSE_DATA + "," +
                                                           Constants.HISTORY_MODIFIED + "," + Constants.HISTORY_REQUEST_SENT + "," +
                                                           Constants.HISTORY_REQUEST_BODY_DECODED + "," + Constants.HISTORY_RESPONSE_BODY_DECODED + "," +
                                                           Constants.HISTORY_EXTRA_INFO + "," + Constants.HISTORY_RAW_POST_DATA + ")" +
                                                           " VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);");
            statement.setInt(1, history.getProfileId());
            statement.setString(2, history.getClientUUID());
            statement.setString(3, history.getCreatedAt());
            statement.setString(4, history.getRequestType());
            statement.setString(5, history.getRequestURL());
            statement.setString(6, history.getRequestParams());
            statement.setString(7, history.getRequestPostData());
            statement.setString(8, history.getRequestHeaders());
            statement.setString(9, history.getResponseCode());
            statement.setString(10, history.getResponseHeaders());
            statement.setString(11, history.getResponseContentType());
            statement.setString(12, history.getResponseData());
            statement.setString(13, history.getOriginalRequestURL());
            statement.setString(14, history.getOriginalRequestParams());
            statement.setString(15, history.getOriginalRequestPostData());
            statement.setString(16, history.getOriginalRequestHeaders());
            statement.setString(17, history.getOriginalResponseCode());
            statement.setString(18, history.getOriginalResponseHeaders());
            statement.setString(19, history.getOriginalResponseContentType());
            statement.setString(20, history.getOriginalResponseData());
            statement.setBoolean(21, history.isModified());
            statement.setBoolean(22, history.getRequestSent());
            statement.setBoolean(23, history.getRequestBodyDecoded());
            statement.setBoolean(24, history.getResponseBodyDecoded());
            statement.setString(25, history.getExtraInfoString());
            statement.setBytes(26, history.getRawPostData());
            statement.executeUpdate();

            // cull history
            cullHistory(history.getProfileId(), history.getClientUUID(), maxHistorySize);
        } catch (Exception e) {
            logger.info(e.getMessage());
        } finally {
            try {
                if (statement != null) {
                    statement.close();
                }
            } catch (Exception e) {
            }
        }
    }
1007354
public void init(Record record, Record recordSub, boolean bRestoreCurrentRecord)
    {
        m_recordSub = recordSub;
        m_bRestoreCurrentRecord = bRestoreCurrentRecord;
        super.init(record);
    }
173677
@Override
	public synchronized RecordTag insert(long historyId, String tag) throws DatabaseException {
        try {
			psInsertTag.setLong(1, historyId);
			psInsertTag.setString(2, tag);
			psInsertTag.executeUpdate();
			
			try (ResultSet rs = psGetIdLastInsert.executeQuery()) {
				rs.next();
				long id = rs.getLong(1);
				return read(id);
			}
		} catch (SQLException e) {
			throw new DatabaseException(e);
		}
    }
273999
public void addResponse(RecordResponse response) {
        if (response.getResponseSize() + getResponseSize() > 248) {
            throw new IllegalArgumentException();
        }

        if (records == null) {
            records = new RecordResponse[1];
        }
        else {
            RecordResponse old[] = records;
            records = new RecordResponse[old.length + 1];

            System.arraycopy(old, 0, records, 0, old.length);
        }
        records[records.length - 1] = response;

        setDataLength(getResponseSize());
    }
1202222
public boolean withRecord(final int key, final RecordWriter writer)
    {
        final int claimedOffset = claimRecord(key);
        if (claimedOffset == DID_NOT_CLAIM_RECORD)
        {
            return false;
        }

        try
        {
            writer.writeRecord(claimedOffset);
        }
        finally
        {
            commit(claimedOffset);
        }

        return true;
    }
279847
public long addRecord(final ORecordId iRid, final byte[] iContent) throws IOException {

    if (iContent.length == 0)
      // AVOID UNUSEFUL CREATION OF EMPTY RECORD: IT WILL BE CREATED AT FIRST UPDATE
      return -1;

    final int recordSize = iContent.length + RECORD_FIX_SIZE;

    acquireExclusiveLock();
    try {

      final long[] newFilePosition = getFreeSpace(recordSize);
      writeRecord(newFilePosition, iRid.clusterId, iRid.clusterPosition, iContent);
      return getAbsolutePosition(newFilePosition);

    } finally {
      releaseExclusiveLock();
    }
  }
507094
public boolean onAdd()
    {
        Record record = this.getMainRecord();
        if (record == null)
            return false;

        try {
            if (record.isModified(false))
            {
                if (record.getEditMode() == Constants.EDIT_IN_PROGRESS)
                    record.set();
                else if (record.getEditMode() == Constants.EDIT_ADD)
                    record.add();
            }
            record.addNew();
            this.clearStatusText();
        } catch(DBException ex) {
            this.displayError(ex);
            return false;
        }
        return true;
    }
100651
public void addNew() throws DBException
    {
        super.addNew();
        Record recCurrent = this.moveToCurrentRecord(null);   // Perhaps, they supplied a default record type and this will switch it.
        if ((recCurrent != null) && (this.getBaseRecord() != recCurrent))
            recCurrent.handleNewRecord(); // Display Fields and do Add behaviors on correct record
        else if ((this.getCurrentRecord() != null) && (this.getCurrentRecord() != this.getBaseRecord()))
        {
            this.getBaseRecord().matchListeners(this.getCurrentRecord(), false, true, true, true, true);      // Clone the listeners that are not there already.
            this.getCurrentRecord().addNew();
        }
    }
198694
public Integer addRecord(Record r) {
        Integer rId = _unsafe_add(r);
        updateMeta(r);
        return rId;
    }
508047
public void addRequest(RecordRequest request) {
        if (request.getRequestSize() + getRequestSize() > 248) {
            throw new IllegalArgumentException();
        }

        if (records == null) {
            records = new RecordRequest[1];
        }
        else {
            RecordRequest old[] = records;
            records = new RecordRequest[old.length + 1];

            System.arraycopy(old, 0, records, 0, old.length);
        }
        records[records.length - 1] = request;

        setDataLength(getRequestSize());
    }
485405
private boolean insertHistoryPrincipals(CmsSetupDb dbCon) throws SQLException {

        System.out.println(new Exception().getStackTrace()[0].toString());

        createHistPrincipalsTable(dbCon);

        boolean updateUserDateDeleted = false;
        if (isKeepHistory() && !hasData(dbCon)) {
            dbCon.updateSqlStatement(readQuery(QUERY_HISTORY_PRINCIPALS_RESOURCES), null, null);
            dbCon.updateSqlStatement(readQuery(QUERY_HISTORY_PRINCIPALS_PROJECTS_GROUPS), null, null);
            dbCon.updateSqlStatement(readQuery(QUERY_HISTORY_PRINCIPALS_PROJECTS_MANAGERGROUPS), null, null);
            dbCon.updateSqlStatement(readQuery(QUERY_HISTORY_PRINCIPALS_PROJECTS_PUBLISHED), null, null);
            dbCon.updateSqlStatement(readQuery(QUERY_HISTORY_PRINCIPALS_PROJECTS_USERS), null, null);
            updateUserDateDeleted = true; // update the colum USER_DATETELETED
        }

        return updateUserDateDeleted;
    }