private void appendRule(StringBuilder stringBuilder, String rule, ConcatenationType concatenationType) {
    if (stringBuilder.length() > 0) {
      switch (concatenationType) {
        case NEW_LINES:
          stringBuilder.append('\n');
          break;
        case NEW_LINES_ESCAPED:
          stringBuilder.append("\\\n");
          break;
        case SPACES:
          stringBuilder.append(" ");
          break;
        case COMMA:
          stringBuilder.append(",");
          break;
        default:
          throw new UnsupportedOperationException(String.format("The auth-to-local rule concatenation type is not supported: %s",
              concatenationType.name()));
      }
    }

    stringBuilder.append(rule);
  }
Append a rule to the given string builder.

@param stringBuilder     string builder to which rule is added
@param rule              rule to add
@param concatenationType the concatenation type to use to generate the rule set string
ambari-server/src/main/java/org/apache/ambari/server/controller/AuthToLocalBuilder.java