private List historyAsJson(BaseCollection<PipelineInstanceModel> pipelineHistory) {
List json = new ArrayList();
for (PipelineInstanceModel item : pipelineHistory) {
Map<String, Object> jsonMap = new LinkedHashMap<>();
jsonMap.put("pipelineId", item.getId());
jsonMap.put("label", item.getLabel());
jsonMap.put("counterOrLabel", item.getPipelineIdentifier().instanceIdentifier());
jsonMap.put("scheduled_date", timeConverter.getHumanReadableStringWithTimeZone(item.getScheduledDate()));
jsonMap.put("scheduled_timestamp", item.getScheduledDate() != null ? item.getScheduledDate().getTime() : null);
jsonMap.put("buildCauseBy", item.getApprovedByForDisplay());
jsonMap.put("modification_date", getModificationDate(item));
jsonMap.put("materialRevisions", materialRevisionsJson(item));
jsonMap.put("stages", stageHistoryAsJson(item, item.getStageHistory()));
jsonMap.put("revision", item.getRevisionOfLatestModification());
jsonMap.put("comment", item.getComment());
json.add(jsonMap);
}
return json;
}