mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

matthew_swift
19.13.2007 8d73d4b84c10e52c5ee187fde05b4d238c3655a9
opendj-sdk/opends/src/server/org/opends/server/tools/dsconfig/CLIProfile.java
@@ -34,6 +34,7 @@
import java.util.Set;
import org.opends.server.admin.AbstractManagedObjectDefinition;
import org.opends.server.admin.InstantiableRelationDefinition;
import org.opends.server.admin.ManagedObjectDefinitionResource;
import org.opends.server.admin.RelationDefinition;
@@ -42,7 +43,7 @@
/**
 * This class is used to access CLI profile annotations.
 */
class CLIProfile {
final class CLIProfile {
  // The singleton instance.
  private static final CLIProfile INSTANCE = new CLIProfile();
@@ -88,6 +89,39 @@
  /**
   * Gets the naming argument which should be used for a relation
   * definition.
   *
   * @param r
   *          The relation definition.
   * @return Returns the naming argument which should be used for a
   *         relation definition.
   */
  public String getNamingArgument(InstantiableRelationDefinition<?, ?> r) {
    String s = resource.getString(r.getParentDefinition(),
        "relation." + r.getName() + ".naming-argument-override").trim();
    if (s.length() == 0) {
      // Use the last word in the managed object name as the argument
      // prefix.
      StringBuilder builder = new StringBuilder();
      s = r.getChildDefinition().getName();
      int i = s.lastIndexOf('-');
      if (i < 0 || i == (s.length() - 1)) {
        builder.append(s);
      } else {
        builder.append(s.substring(i + 1));
      }
      builder.append("-name");
      s = builder.toString();
    }
    return s;
  }
  /**
   * Determines if instances of the specified managed object
   * definition are to be used for customization.
   *