From 7971d7f22c12dc126b0c7098be194f4ab251b78b Mon Sep 17 00:00:00 2001
From: Ludovic Poitou <ludovic.poitou@forgerock.com>
Date: Thu, 10 Dec 2015 10:52:25 +0000
Subject: [PATCH] OPENDJ-2521 - Unable to import data into new backend/baseDN using control panel. With pluggable backends, the import code no longer support the --append Mode (and the replaceExisting option). ImportLDIF.java: Remove the append and replaceExisting options ImportTask.java: Remove the append and replaceExisting options and checks done with these options ControlPanel/NewBaseDNPanel: Remove call to --append option ControlPanel/ImportLDIFPanel: Remove code and UI elements that deal with the append and replaceExisting options TestImportAndExport.java: Remove use of append and replaceExisting options admin_tool*.properties: Remove the labels removed from the Control Panel UI.

---
 opendj-server-legacy/src/main/java/org/opends/server/tools/ImportLDIF.java |   50 +-------------------------------------------------
 1 files changed, 1 insertions(+), 49 deletions(-)

diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tools/ImportLDIF.java b/opendj-server-legacy/src/main/java/org/opends/server/tools/ImportLDIF.java
index 8dbb4a7..8a259cd 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tools/ImportLDIF.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tools/ImportLDIF.java
@@ -148,14 +148,12 @@
   }
 
   /** Define the command-line arguments that may be used with this program. */
-  private BooleanArgument append;
   private BooleanArgument countRejects;
   private BooleanArgument displayUsage;
   private BooleanArgument isCompressed;
   private BooleanArgument isEncrypted;
   private BooleanArgument overwrite;
   private BooleanArgument quietMode;
-  private BooleanArgument replaceExisting;
   private BooleanArgument skipSchemaValidation;
   private BooleanArgument clearBackend;
   private IntegerArgument randomSeed;
@@ -331,20 +329,6 @@
                               INFO_LDIFIMPORT_DESCRIPTION_TEMPLATE_FILE.get());
       argParser.addArgument(templateFile);
 
-
-      append =
-           new BooleanArgument("append", 'a', "append",
-                               INFO_LDIFIMPORT_DESCRIPTION_APPEND.get());
-      argParser.addArgument(append);
-
-
-      replaceExisting =
-           new BooleanArgument(
-                   "replaceexisting", 'r', "replaceExisting",
-                   INFO_LDIFIMPORT_DESCRIPTION_REPLACE_EXISTING.get());
-      argParser.addArgument(replaceExisting);
-
-
       backendID =
            new StringArgument("backendid", 'n', "backendID", false, false, true,
                               INFO_BACKENDNAME_PLACEHOLDER.get(), null, null,
@@ -507,8 +491,6 @@
     addAttribute(attributes, ATTR_IMPORT_THREAD_COUNT, threadCount.getValue());
 
     // Optional attributes
-    addAttribute2(attributes, ATTR_IMPORT_APPEND, append);
-    addAttribute2(attributes, ATTR_IMPORT_REPLACE_EXISTING, replaceExisting);
     addAttribute2(attributes, ATTR_IMPORT_BACKEND_ID, backendID);
     addAttribute(attributes, ATTR_IMPORT_INCLUDE_ATTRIBUTE, includeAttributeStrings.getValues());
     addAttribute(attributes, ATTR_IMPORT_EXCLUDE_ATTRIBUTE, excludeAttributeStrings.getValues());
@@ -571,8 +553,7 @@
                            PrintStream err) {
 
 
-    // Perform the initial bootstrap of the Directory Server and process the
-    // configuration.
+    // Perform the initial bootstrap of the Directory Server and process the configuration.
     DirectoryServer directoryServer = DirectoryServer.getInstance();
     if (initializeServer)
     {
@@ -932,21 +913,6 @@
       }
     }
 
-    // Make sure that if the "backendID" argument was provided, no include base
-    // was included, the
-    // "clearBackend" argument was also provided if there are more then one
-    // baseDNs for the backend being imported.
-
-    if(backendID.isPresent() && !includeBranchStrings.isPresent() &&
-       !append.isPresent() &&
-        defaultIncludeBranches.size() > 1 &&
-        !clearBackend.isPresent())
-    {
-      StringBuilder builder = join(backend.getBaseDNs(), " / ");
-      printWrappedText(err, ERR_LDIFIMPORT_MISSING_CLEAR_BACKEND.get(builder, clearBackend.getLongIdentifier()));
-      return 1;
-    }
-
     for (String s : excludeBranchStrings.getValues())
     {
       DN excludeBranch;
@@ -1032,8 +998,6 @@
 
 
       // Create the LDIF import configuration to use when reading the LDIF.
-      importConfig.setAppendToExistingData(append.isPresent());
-      importConfig.setReplaceExistingEntries(replaceExisting.isPresent());
       importConfig.setCompressed(isCompressed.isPresent());
       importConfig.setClearBackend(clearBackend.isPresent());
       importConfig.setEncrypted(isEncrypted.isPresent());
@@ -1219,18 +1183,6 @@
     return false;
   }
 
-  private StringBuilder join(final DN[] baseDNs, final String separator)
-  {
-    final StringBuilder builder = new StringBuilder();
-    builder.append(baseDNs[0]);
-    for (int i = 1; i < baseDNs.length; i++)
-    {
-      builder.append(separator);
-      builder.append(baseDNs[i]);
-    }
-    return builder;
-  }
-
   private Random newRandom()
   {
     if (randomSeed.isPresent())

--
Gitblit v1.10.0