private List<AlertCurrentEntity> supplementWithCachedAlerts(List<AlertCurrentEntity> alerts) {
    List<AlertCurrentEntity> cachedAlerts = new ArrayList<>(alerts.size());

    for (AlertCurrentEntity alert : alerts) {
      AlertCacheKey key = AlertCacheKey.build(alert);
      AlertCurrentEntity cachedEntity = m_currentAlertCache.getIfPresent(key);
      if (null != cachedEntity) {
        if (cachedEntity.getAlertHistory() == null) {
          LOG.warn("There is current entity with null history in the cache, currentId: {}, persisted historyId: {}",
              cachedEntity.getAlertId(), alert.getHistoryId());
        }
        alert = cachedEntity;
      }

      cachedAlerts.add(alert);
    }

    return cachedAlerts;
  }
Gets a list that is comprised of the original values replaced by any cached
values from {@link #m_currentAlertCache}. This method should only be
invoked if {@link Configuration#isAlertCacheEnabled()} is {@code true}

@param alerts
         the list of alerts to iterate over and replace with cached
         instances.
@return the list of alerts from JPA combined with any cached alerts.
ambari-server/src/main/java/org/apache/ambari/server/orm/dao/AlertsDAO.java