public static String compareBuildTypes()

in rest-api/src/jetbrains/buildServer/server/rest/model/buildType/BuildTypeUtil.java [338:470]


  public static String compareBuildTypes(@Nullable final BuildTypeSettingsEx a, @Nullable final BuildTypeSettingsEx b, boolean compareInheritedFlag, boolean compareIds) {
    if (a == b) return null;
    if (a == null) return "null <-> not null";
    if (b == null) return "not null <-> null";
    final Map<String, String> idMapping = new HashMap<>();
    StringBuilder result = new StringBuilder();
    result.append(compare("option", a.getOptions(), a.getOwnOptions(), b.getOptions(), b.getOwnOptions(), true, (result1, oA, oB, entityName, fieldPrefix) -> {
      result1.append(compareObjects(entityName, oA.getKey(), oB.getKey(), fieldPrefix + "key"));
      result1.append(compareObjects(entityName, a.getOption(oA), b.getOption(oB), fieldPrefix + "value"));
    }));
    result.append(compare("vcsRootEntry", a.getVcsRootEntries(), a.getOwnVcsRootEntries(), b.getVcsRootEntries(), b.getOwnVcsRootEntries(), compareInheritedFlag,
                          (result1, oA, oB, entityName, fieldPrefix) -> {
                            result1.append(compareObjects(entityName, oA.getCheckoutRules().getAsString(), oB.getCheckoutRules().getAsString(), fieldPrefix + "checkoutRules"));
                            result1.append(compareObjects(entityName, oA.getVcsRoot().getId(), oB.getVcsRoot().getId(), fieldPrefix + "vcRootId"));
                          }));
    result.append(compare("step", a.getBuildRunners(), a.getOwnBuildRunners(), b.getBuildRunners(), b.getOwnBuildRunners(), compareInheritedFlag,
                          (result1, oA, oB, entityName, fieldPrefix) -> {
                            idMapping.put(oA.getId(), oB.getId());
                            if (compareIds) result1.append(compareObjects("step", oA.getId(), oB.getId(), fieldPrefix + "id"));
                            result1.append(compareObjects(entityName, oA.getRunType().getType(), oB.getRunType().getType(), fieldPrefix + "type"));
                            result1.append(compareObjects(entityName, oA.getName(), oB.getName(), fieldPrefix + "name"));
                            result1.append(compareObjects(entityName, oA.getOwnBuildParameters(), oB.getOwnBuildParameters(), fieldPrefix + "parameters"));
                          }));
    result.append(compare("feature", a.getBuildFeatures(), a.getOwnBuildFeatures(), b.getBuildFeatures(), b.getOwnBuildFeatures(), compareInheritedFlag,
                          (result1, oA, oB, entityName, fieldPrefix) -> {
                            idMapping.put(oA.getId(), oB.getId());
                            if (compareIds) result1.append(compareObjects("feature", oA.getId(), oB.getId(), fieldPrefix + "id"));
                            result1.append(compareObjects(entityName, oA.getBuildFeature().getType(), oB.getBuildFeature().getType(), fieldPrefix + "type"));
                            result1.append(compareObjects(entityName, oA.getParameters(), oB.getParameters(), fieldPrefix + "parameters"));
                          }));
    result.append(compare("snapshotDependency", a.getDependencies(), a.getOwnDependencies(), b.getDependencies(), b.getOwnDependencies(), compareInheritedFlag,
                          (result1, oA, oB, entityName, fieldPrefix) -> {
                            result1.append(compareObjects(entityName, oA.getDependOnExternalId(), oB.getDependOnExternalId(), fieldPrefix + "source buildType id"));
                            result1.append(compareObjects(entityName, oA.getOptions(), oB.getOptions(), fieldPrefix + "options"));
                          }));
    result.append(compare("artifactDependency", a.getArtifactDependencies(), a.getOwnArtifactDependencies(), b.getArtifactDependencies(), b.getOwnArtifactDependencies(),
                          compareInheritedFlag,
                          (result1, oA, oB, entityName, fieldPrefix) -> {
                            idMapping.put(oA.getId(), oB.getId());
                            if (compareIds) result1.append(compareObjects(entityName, oA.getId(), oB.getId(), fieldPrefix + "id"));
                            result1.append(compareObjects(entityName, oA.getSourceExternalId(), oB.getSourceExternalId(), fieldPrefix + "source buildType id"));
                            result1.append(compareObjects(entityName, oA.getSourcePaths(), oB.getSourcePaths(), fieldPrefix + "paths"));
                            result1.append(compareObjects(entityName, oA.isCleanDestinationFolder(), oB.isCleanDestinationFolder(), fieldPrefix + "clean destination"));
                            result1.append(compareObjects(entityName, oA.getRevisionRule().getName(), oB.getRevisionRule().getName(), fieldPrefix + "revision name"));
                            result1.append(compareObjects(entityName, oA.getRevisionRule().getRevision(), oB.getRevisionRule().getRevision(), fieldPrefix + "revision"));
                            result1.append(compareObjects(entityName, oA.getRevisionRule().getBranch(), oB.getRevisionRule().getBranch(), fieldPrefix + "revision branch"));
                          }));
    result.append(compare("trigger", a.getBuildTriggersCollection(), a.getOwnBuildTriggers(), b.getBuildTriggersCollection(), b.getOwnBuildTriggers(),
                          compareInheritedFlag,
                          (result1, oA, oB, entityName, fieldPrefix) -> {
                            idMapping.put(oA.getId(), oB.getId());
                            if (compareIds) result1.append(compareObjects(entityName, oA.getId(), oB.getId(), fieldPrefix + "id"));
                            result1.append(compareObjects(entityName, oA.getType(), oB.getType(), fieldPrefix + "type"));
                            result1.append(compareObjects(entityName, oA.getTriggerName(), oB.getTriggerName(), fieldPrefix + "name"));
                            result1.append(compareObjects(entityName, oA.getParameters(), oB.getParameters(), fieldPrefix + "parameters"));
                            result1.append(compareObjects(entityName, oA.getProperties(), oB.getProperties(), fieldPrefix + "properties"));
                          }));
    result.append(compare("requirement", a.getRequirements(), a.getOwnRequirements(), b.getRequirements(), b.getOwnRequirements(), compareInheritedFlag,
                          (result1, oA, oB, entityName, fieldPrefix) -> {
                            idMapping.put(oA.getId(), oB.getId());
                            if (compareIds) result1.append(compareObjects(entityName, oA.getId(), oB.getId(), fieldPrefix + "id"));
                            result1.append(compareObjects(entityName, oA.getType(), oB.getType(), fieldPrefix + "type"));
                            result1.append(compareObjects(entityName, oA.getPropertyName(), oB.getPropertyName(), fieldPrefix + "property name"));
                            result1.append(compareObjects(entityName, oA.getPropertyValue(), oB.getPropertyValue(), fieldPrefix + "value"));
                          }));
    result.append(compare("parameter", a.getParametersCollection(), a.getOwnParametersCollection(), b.getParametersCollection(), b.getOwnParametersCollection(),
                          compareInheritedFlag,
                          (result1, oA, oB, entityName, fieldPrefix) -> {
                            result1.append(compareObjects(entityName, oA.getName(), oB.getName(), fieldPrefix + "name"));
                            result1.append(compareObjects(entityName, oA.getValue(), oB.getValue(), fieldPrefix + "value"));
                            if (oA.getControlDescription() == null && oB.getControlDescription() == null) return;
                            if (oA.getControlDescription() == null || oB.getControlDescription() == null) {
                              result1.append(compareObjects(entityName, oA.getControlDescription() == null, oB.getControlDescription() == null, fieldPrefix + "type"));
                              return;
                            }
                            result1.append(compareObjects(entityName, oA.getControlDescription().getParameterType(), oB.getControlDescription().getParameterType(),
                                                         fieldPrefix + "type"));
                            result1.append(compareObjects(entityName, oA.getControlDescription().getParameterTypeArguments(), oB.getControlDescription().getParameterTypeArguments(),
                                                         fieldPrefix + "type arguments"));
                          }));
    result.append(compareCleanupOptions(a.getOwnCleanupSupport(), b.getOwnCleanupSupport(), compareInheritedFlag));

    if (compareIds) {
      result.append(compare("disabledSetting", a.getDisabledParameterDescriptorIds(), a.getOwnDisabledParameterDescriptorIds(), b.getDisabledParameterDescriptorIds(),
                            b.getOwnDisabledParameterDescriptorIds(), compareInheritedFlag,
                            (result1, oA, oB, entityName, fieldPrefix) -> {
                              result1.append(compareObjects(entityName, oA, oB, fieldPrefix + "id"));
                            }));
    } else {
      {
        Collection<String> disabledB = b.getDisabledParameterDescriptorIds();
        Set<String> disabledBRest = new HashSet<>(disabledB);
        for (String aId : a.getDisabledParameterDescriptorIds()) {
          boolean contained = disabledBRest.remove(idMapping.get(aId));
          compareObjects("disabledSetting", true, contained, aId);
        }
        for (String bId : disabledBRest) {
          compareObjects("disabledSetting", false, true, bId);
        }
      }
      {
        Collection<String> disabledB = b.getOwnDisabledParameterDescriptorIds();
        Set<String> disabledBRest = new HashSet<>(disabledB);
        for (String aId : a.getOwnDisabledParameterDescriptorIds()) {
          boolean contained = disabledBRest.remove(idMapping.get(aId));
          compareObjects("disabledSetting", true, contained, "own " + aId);
        }
        for (String bId : disabledBRest) {
          compareObjects("disabledSetting", false, true, "own " + bId);
        }
      }
    }

    return result.length() == 0 ? null : result.toString();

/* Not using for comparison:
ProjectEx getProject()
boolean isTemplateBased()
BuildTypeTemplateEx getTemplate()

to process:
String[] getOwnRunnersOrder()

use?:
getOwnSerializableParameters
CleanupSettingsSupport getOwnCleanupSupport()


//derived:
List<Requirement> getRunTypeRequirements()
List<Requirement> getImplicitRequirements()
     */
  }