public UpgradeInformation buildUpgradeInformation() {
    RepositoryVersionEntity targetRepositoryVersionEntity = m_repositoryVersion;

    Map<String, Service> clusterServices = m_cluster.getServices();
    Map<String, RepositoryVersion> clusterServiceVersions = new HashMap<>();
    if (null != clusterServices) {
      for (Map.Entry<String, Service> serviceEntry : clusterServices.entrySet()) {
        Service service = serviceEntry.getValue();
        RepositoryVersionEntity desiredRepositoryEntity = service.getDesiredRepositoryVersion();
        RepositoryVersion desiredRepositoryVersion = desiredRepositoryEntity.getRepositoryVersion();

        clusterServiceVersions.put(serviceEntry.getKey(), desiredRepositoryVersion);
      }
    }

    Map<String, RepositoryVersionEntity> sourceVersionEntites = getSourceVersions();
    Map<String, RepositoryVersionEntity> targetVersionEntites = getTargetVersions();
    Map<String, RepositoryVersion> sourceVersions = new HashMap<>();
    Map<String, RepositoryVersion> targetVersions = new HashMap<>();

    sourceVersionEntites.forEach(
        (service, repositoryVersion) -> sourceVersions.put(service, repositoryVersion.getRepositoryVersion()));

    targetVersionEntites.forEach(
        (service, repositoryVersion) -> targetVersions.put(service, repositoryVersion.getRepositoryVersion()));

    UpgradeInformation upgradeInformation = new UpgradeInformation(
        getDirection().isUpgrade(), getType(),
        targetRepositoryVersionEntity.getRepositoryVersion(), sourceVersions, targetVersions);

    return upgradeInformation;
  }
Builds a {@link UpgradeInformation} instance from a {@link Cluster} where
there is an upgrade in progress.

@return the {@link UpgradeInformation} instance comprised of simple POJOs
        and SPI classes.
ambari-server/src/main/java/org/apache/ambari/server/stack/upgrade/orchestrate/UpgradeContext.java