public void merge(StackRoleCommandOrder parent, boolean mergeProperties) {
    HashMap<String, Object> mergedRoleCommandOrders = new HashMap<>();
    HashMap<String, Object> parentData = parent.getContent();

    List<String> keys = Arrays.asList(GENERAL_DEPS_KEY, GLUSTERFS_DEPS_KEY, NO_GLUSTERFS_DEPS_KEY,
        NAMENODE_HA_DEPS_KEY, RESOURCEMANAGER_HA_DEPS_KEY, HOST_ORDERED_UPGRADES_DEPS_KEY);

    for (String key : keys) {
      if (parentData.containsKey(key) && content.containsKey(key)) {
        Map<String, Object> result = new HashMap<>();
        Map<String, Object> parentProperties = (Map<String, Object>) parentData.get(key);
        Map<String, Object> childProperties = (Map<String, Object>) content.get(key);
        MultiValueMap childAndParentProperties = null;

        childAndParentProperties = new MultiValueMap();
        childAndParentProperties.putAll(childProperties);
        childAndParentProperties.putAll(parentProperties);

        for (Object property : childAndParentProperties.keySet()) {
          List propertyValues = (List) childAndParentProperties.get(property);
          Object values = propertyValues.get(0);
          if (mergeProperties) {
            List<String> valueList = new ArrayList<>();
            for (Object value : propertyValues) {
              if (value instanceof List) {
                valueList.addAll((List<String>) value);
              } else {
                valueList.add(value.toString());
              }
            }
            values = valueList;
          }

          result.put((String) property, values);
        }
        mergedRoleCommandOrders.put(key, result);
      } else if (content.containsKey(key)) {
        mergedRoleCommandOrders.put(key, content.get(key));
      } else if (parentData.containsKey(key)) {
        mergedRoleCommandOrders.put(key, parentData.get(key));
      }
    }
    content = mergedRoleCommandOrders;
  }
merge StackRoleCommandOrder content with parent

@param parent parent StackRoleCommandOrder instance
ambari-server/src/main/java/org/apache/ambari/server/state/stack/StackRoleCommandOrder.java