public UpgradeSummary getUpgradeSummary() {
    UpgradeSummary summary = new UpgradeSummary();
    summary.direction = m_direction;
    summary.type = m_type;
    summary.orchestration = m_orchestration;
    summary.isRevert = m_isRevert;

    summary.isDowngradeAllowed = isDowngradeAllowed();

    summary.associatedRepositoryId = m_repositoryVersion.getId();
    summary.associatedStackId = m_repositoryVersion.getStackId().getStackId();
    summary.associatedVersion = m_repositoryVersion.getVersion();

    // !!! a) if we are reverting, that can only happen via PATCH or MAINT
    //     b) if orchestration is a revertible type (on upgrade)
    summary.isSwitchBits = m_isRevert || m_orchestration.isRevertable();

    summary.services = new HashMap<>();

    for (String serviceName : m_services) {
      RepositoryVersionEntity sourceRepositoryVersion = m_sourceRepositoryMap.get(serviceName);
      RepositoryVersionEntity targetRepositoryVersion = m_targetRepositoryMap.get(serviceName);
      if (null == sourceRepositoryVersion || null == targetRepositoryVersion) {
        LOG.warn("Unable to get the source/target repositories for {} for the upgrade summary",
            serviceName);
        continue;
      }

      UpgradeServiceSummary serviceSummary = new UpgradeServiceSummary();
      serviceSummary.sourceRepositoryId = sourceRepositoryVersion.getId();
      serviceSummary.sourceStackId = sourceRepositoryVersion.getStackId().getStackId();
      serviceSummary.sourceVersion = sourceRepositoryVersion.getVersion();

      serviceSummary.targetRepositoryId = targetRepositoryVersion.getId();
      serviceSummary.targetStackId = targetRepositoryVersion.getStackId().getStackId();
      serviceSummary.targetVersion = targetRepositoryVersion.getVersion();

      summary.services.put(serviceName, serviceSummary);
    }

    return summary;
  }
Gets a POJO of the upgrade suitable to serialize.

@return the upgrade summary as a POJO.
ambari-server/src/main/java/org/apache/ambari/server/stack/upgrade/orchestrate/UpgradeContext.java