From 57dcbf9c69ce5f0bba384b88555b48a5d87d3476 Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Mon, 02 Jan 2012 15:58:40 +0000
Subject: [PATCH] Fix OPENDJ-391: Improve List existing Local DB Indexes output in dsconfig
---
opends/src/server/org/opends/server/tools/dsconfig/ListSubCommandHandler.java | 50 ++++++++++++++++++++++++++++++--------------------
1 files changed, 30 insertions(+), 20 deletions(-)
diff --git a/opends/src/server/org/opends/server/tools/dsconfig/ListSubCommandHandler.java b/opends/src/server/org/opends/server/tools/dsconfig/ListSubCommandHandler.java
index 032ea9c..c60a7ff 100644
--- a/opends/src/server/org/opends/server/tools/dsconfig/ListSubCommandHandler.java
+++ b/opends/src/server/org/opends/server/tools/dsconfig/ListSubCommandHandler.java
@@ -22,6 +22,7 @@
* CDDL HEADER END
*
* Copyright 2008-2009 Sun Microsystems, Inc.
+ * Portions copyright 2012 ForgeRock AS.
*/
package org.opends.server.tools.dsconfig;
@@ -418,11 +419,18 @@
app.println(Message.raw(name));
}
} else {
- // Create a table of their properties.
+ // Create a table of their properties containing the name, type (if
+ // appropriate), and requested properties.
+ SortedMap<String, ?> subTypes =
+ getSubTypes(relation.getChildDefinition());
+ boolean includeTypesColumn = (subTypes.size() != 1
+ || !subTypes.containsKey(DSConfig.GENERIC_TYPE));
+
TableBuilder builder = new TableBuilder();
builder.appendHeading(relation.getUserFriendlyName());
- builder
- .appendHeading(INFO_DSCFG_HEADING_COMPONENT_TYPE.get());
+ if (includeTypesColumn) {
+ builder.appendHeading(INFO_DSCFG_HEADING_COMPONENT_TYPE.get());
+ }
for (String propertyName : propertyNames) {
builder.appendHeading(Message.raw(propertyName));
}
@@ -453,25 +461,27 @@
builder.appendCell(name);
}
- // Output the managed object type in the form used in
- // create-xxx commands.
- String childType = d.getName();
- boolean isCustom = CLIProfile.getInstance().isForCustomization(d);
- if (baseType.equals(childType)) {
- if (isCustom) {
- builder.appendCell(DSConfig.CUSTOM_TYPE);
+ if (includeTypesColumn) {
+ // Output the managed object type in the form used in
+ // create-xxx commands.
+ String childType = d.getName();
+ boolean isCustom = CLIProfile.getInstance().isForCustomization(d);
+ if (baseType.equals(childType)) {
+ if (isCustom) {
+ builder.appendCell(DSConfig.CUSTOM_TYPE);
+ } else {
+ builder.appendCell(DSConfig.GENERIC_TYPE);
+ }
+ } else if (childType.endsWith(typeSuffix)) {
+ String ctname = childType.substring(0, childType.length()
+ - typeSuffix.length());
+ if (isCustom) {
+ ctname = String.format("%s-%s", DSConfig.CUSTOM_TYPE, ctname);
+ }
+ builder.appendCell(ctname);
} else {
- builder.appendCell(DSConfig.GENERIC_TYPE);
+ builder.appendCell(childType);
}
- } else if (childType.endsWith(typeSuffix)) {
- String ctname = childType.substring(0, childType.length()
- - typeSuffix.length());
- if (isCustom) {
- ctname = String.format("%s-%s", DSConfig.CUSTOM_TYPE, ctname);
- }
- builder.appendCell(ctname);
- } else {
- builder.appendCell(childType);
}
// Now any requested properties.
--
Gitblit v1.10.0