class ConfigurationMergeCheck extends AbstractCheckDescriptor {

  @Override
  public void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request)
      throws AmbariException {

    RepositoryVersionEntity rve = request.getTargetRepositoryVersion();

    Map<String, Map<String, ThreeWayValue>> changes =
        m_mergeHelper.getConflicts(request.getClusterName(), rve.getStackId());

    Set<String> failedTypes = new HashSet<>();

    for (Entry<String, Map<String, ThreeWayValue>> entry : changes.entrySet()) {
      for (Entry<String, ThreeWayValue> configEntry : entry.getValue().entrySet()) {

        ThreeWayValue twv = configEntry.getValue();
        if (null == twv.oldStackValue) { // !!! did not exist and in the map means changed
          failedTypes.add(entry.getKey());

          prerequisiteCheck.getFailedOn().add(entry.getKey() + "/" + configEntry.getKey());

          MergeDetail md = new MergeDetail();
          md.type = entry.getKey();
          md.property = configEntry.getKey();
          md.current = twv.savedValue;
          md.new_stack_value = twv.newStackValue;
          md.result_value = md.current;
          prerequisiteCheck.getFailedDetail().add(md);

        } else if (!twv.oldStackValue.equals(twv.savedValue)) {  // !!! value customized
          if (null == twv.newStackValue || // !!! not in new stack
              !twv.oldStackValue.equals(twv.newStackValue)) { // !!! or the default value changed
            failedTypes.add(entry.getKey());

            prerequisiteCheck.getFailedOn().add(entry.getKey() + "/" + configEntry.getKey());

            MergeDetail md = new MergeDetail();
            md.type = entry.getKey();
            md.property = configEntry.getKey();
            md.current = twv.savedValue;
            md.new_stack_value = twv.newStackValue;
            md.result_value = md.current;
            prerequisiteCheck.getFailedDetail().add(md);
          }
        }
      }
    }

    if (prerequisiteCheck.getFailedOn().size() > 0) {
      prerequisiteCheck.setStatus(PrereqCheckStatus.WARNING);
      String failReason = getFailReason(prerequisiteCheck, request);

      prerequisiteCheck.setFailReason(String.format(failReason, StringUtils.join(
          failedTypes, ", ")));

    } else {
      prerequisiteCheck.setStatus(PrereqCheckStatus.PASS);
    }
  }

  public  ConfigurationMergeCheck();

}