Create keyhistory from original key history and current message key.

@param history original key history
@param messageKey current message key
@return created key history
554015
protected KeyHistory createKeyRecorededHistory(KeyHistory history, Object messageKey)
    {
        KeyHistory result = null;

        if (history == null)
        {
            result = new KeyHistory();
        }
        else
        {
            // For adjust message splited, use keyhistory's deepcopy.
            result = history.createDeepCopy();
        }

        result.addKey(messageKey.toString());

        return result;
    }
218949
@Override
	public synchronized List<RecordTag> getTagsForHistoryID (long historyId) throws DatabaseException {
    	try {
			List<RecordTag> result = new ArrayList<>();
			psGetTagsForHistoryId.setLong(1, historyId);
			try (ResultSet rs = psGetTagsForHistoryId.executeQuery()) {
				while (rs.next()) {
					result.add(new RecordTag(rs.getLong(TAGID), rs.getLong(TAGID), rs.getString(TAG)));
				}
			}
			
			return result;
		} catch (SQLException e) {
			throw new DatabaseException(e);
		}
    }
1031124
public java.util.List<HistoryRecordEntry> getHistoryRecords() {
        if (historyRecords == null) {
            historyRecords = new com.amazonaws.internal.SdkInternalList<HistoryRecordEntry>();
        }
        return historyRecords;
    }
945730
public static void addHistory(@NonNull Intent intent, @NonNull History history,
      @NonNull KeyParceler parceler) {
    InternalLifecycleIntegration.addHistoryToIntent(intent, history, parceler);
  }
279737
function getHistory(context) {
  if (!historyMap.has(context)) {
    clear(context);
  }
  return historyMap.get(context);
}
690269
public static systemeventhistory[] get(nitro_service service, systemeventhistory_args args) throws Exception{
		systemeventhistory obj = new systemeventhistory();
		options option = new options();
		option.set_args(nitro_util.object_to_string_withoutquotes(args));
		systemeventhistory[] response = (systemeventhistory[])obj.get_resources(service, option);
		return response;
	}
523582
public Entry buildWithHistory() {
        if (originalEntry == null) {
            throw new IllegalArgumentException("originalEntry is not set");
        }

        if (history == null) {
            history = new History();
        }

        Entry entryWithoutHistory = new EntryBuilder(originalEntry).history(new History()).build();
        history.getHistoricEntries().add(entryWithoutHistory);
        return build();
    }
831424
@NonNull public static History single(@NonNull Object key) {
    return emptyBuilder().push(key).build();
  }
960135
def _get_history_id(self, connection, agent_id, instance_id):
        '''
        
        '''
        cache_key = (agent_id, instance_id, )
        if cache_key in self._history_id_cache:
            history_id = self._history_id_cache[cache_key]
            return history_id
        else:
            command = text_helper.format_block("""
            SELECT id FROM histories WHERE agent_id = ? AND instance_id = ?
            """)
            cursor = connection.cursor()
            cursor.execute(command, (agent_id, instance_id, ))
            res = cursor.fetchall()
            if res:
                history_id = res[0][0]
                self._history_id_cache[cache_key] = history_id
                return history_id
            else:
                command = 'INSERT INTO histories VALUES (NULL, ?, ?)'
                cursor.execute(command, (agent_id, instance_id, ))
                history_id = cursor.lastrowid
                self._history_id_cache[cache_key] = history_id
                return history_id
267558
@Override
	public void keyReleased(KeyEvent e){

		int code = e.getKeyCode();
		//String s = e.getKeyText(code);
		//System.out.println(s);
		if (( code == KeyEvent.VK_UP ) ||
				( code == KeyEvent.VK_KP_UP)) {
			// go one back in history;
			if ( historyPosition > 0){
				historyPosition= historyPosition-1;
			}
		} else if (( code == KeyEvent.VK_DOWN ) ||
				( code == KeyEvent.VK_KP_DOWN)) {
			if ( historyPosition < (history.size()-1) ){
				historyPosition++;
			} else {
				// clear command if at beginning of history
				textfield.setText("");
				historyPosition=history.size();
				return;
			}
		} else if ( code == KeyEvent.VK_PAGE_UP) {
			if ( historyPosition > 0) {
				historyPosition = 0;
			}
		} else if ( code == KeyEvent.VK_PAGE_DOWN) {
			if ( historyPosition >= 0) {
				historyPosition = history.size()-1;
			}
		} else {
			// some other key has been pressed, do nothing
			return;
		}

		if ( historyPosition >= 0) {
			String txt = history.get(historyPosition);
			textfield.setText(txt);
		}


	}
1193045
def write_to_history(**kwargs):
        
        from hyperstream import HyperStream
        hs = HyperStream(loglevel=logging.CRITICAL, file_logger=False, console_logger=False, mqtt_logger=None)
        if hs.current_session:
            hs.current_session.write_to_history(**kwargs)
386952
@RequestMapping(value = "/api/history/{profileIdentifier}/{id}", method = RequestMethod.GET)
    public
    @ResponseBody
    HashMap<String, Object> getHistoryForId(Model mode, @PathVariable String profileIdentifier, @PathVariable Integer id,
                                            @RequestParam(value = "format", required = false) String formatted) {
        HashMap<String, Object> returnData = new HashMap<String, Object>();
        History history = HistoryService.getInstance().getHistoryForID(id);
        if (formatted != null) {
            try {
                if (formatted.equals("formattedAll")) {
                    history.setFormattedResponseData(history.getResponseData());
                    history.setFormattedOriginalResponseData(history.getOriginalResponseData());
                } else if (formatted.equals("formattedModified")) {
                    history.setFormattedResponseData(history.getResponseData());
                } else if (formatted.equals("formattedOriginal")) {
                    history.setFormattedOriginalResponseData(history.getOriginalResponseData());
                }
                returnData.put("history", history);
            } catch (Exception e) {
                e.printStackTrace();
            }
        } else {
            returnData = new HashMap<String, Object>();
            returnData.put("history", HistoryService.getInstance().getHistoryForID(id));
        }

        return returnData;
    }
801330
@Override
	public synchronized List<RecordAlert> getAlertsBySourceHistoryId(int historyId) throws DatabaseException {
        try {
			List<RecordAlert> result = new ArrayList<>();
			psGetAlertsForHistoryId.setLong(1, historyId);
			try (ResultSet rs = psGetAlertsForHistoryId.executeQuery()) {
			    RecordAlert ra = build(rs);
			    while (ra != null) {
			        result.add(ra);
			        ra = build(rs);
			    }
			}
			
			return result;
		} catch (SQLException e) {
			throw new DatabaseException(e);
		}
    }
395476
public static JobHistoryFileParser createJobHistoryFileParser(
      byte[] historyFileContents, Configuration jobConf) throws IllegalArgumentException {

    if (historyFileContents == null) {
      throw new IllegalArgumentException(
          "Job history contents should not be null");
    }

    HadoopVersion version = getVersion(historyFileContents);

    switch (version) {
    case TWO:
      return new JobHistoryFileParserHadoop2(jobConf);

    default:
      throw new IllegalArgumentException(
          " Unknown format of job history file ");
    }
  }
1358306
private void createKeysIfNotExist() {
        if (!keyPairExists()) {
            try {
                final KeyPair keyPair = generateKeyPair();
                save(keyPair);
            } catch (NoSuchAlgorithmException e) {
                LOGGER.error("An error occurred generating new keypair");
                LOGGER.error(e.getMessage());
            } catch (IOException e) {
                LOGGER.error("An error occurred saving newly generated keypair");
                LOGGER.error(e.getMessage());
            }
        }
        if (!secretKeyExists()) {
            try {
                final SecretKey secretKey = generateSecretKey();
                save(secretKey);
            } catch (NoSuchAlgorithmException e) {
                LOGGER.error("An error occurred generating new secret key");
                LOGGER.error(e.getMessage());
            } catch (IOException e) {
                LOGGER.error("An error occurred saving newly generated secret key");
                LOGGER.error(e.getMessage());
            }
        }
    }
449173
private String getKey(String key) throws IllegalArgumentException {
    String checkKey =
        JobHistoryKeys.HADOOP2_TO_HADOOP1_MAPPING.containsKey(key) ? JobHistoryKeys.HADOOP2_TO_HADOOP1_MAPPING
            .get(key) : key;
    return (JobHistoryKeys.valueOf(checkKey).toString());
  }
1139692
def bulk_history_create(self, objs, batch_size=None):
        """"""

        historical_instances = [
            self.model(
                history_date=getattr(instance, "_history_date", now()),
                history_user=getattr(instance, "_history_user", None),
                history_change_reason=getattr(instance, "changeReason", ""),
                history_type="+",
                **{
                    field.attname: getattr(instance, field.attname)
                    for field in instance._meta.fields
                    if field.name not in self.model._history_excluded_fields
                }
            )
            for instance in objs
        ]

        return self.model.objects.bulk_create(
            historical_instances, batch_size=batch_size
        )