From 572fb271e9866c819a28b6bdcaf6f8db74814ff3 Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Thu, 30 Nov 2006 20:04:25 +0000
Subject: [PATCH] Update the LDIF export utility to provide a way to exclude operational attributes from the export.

---
 opendj-sdk/opends/src/server/org/opends/server/tools/ExportLDIF.java       |    9 +++++++++
 opendj-sdk/opends/src/server/org/opends/server/types/LDIFExportConfig.java |   20 ++++++++++++++++++++
 opendj-sdk/opends/src/server/org/opends/server/messages/ToolMessages.java  |   11 +++++++++++
 3 files changed, 40 insertions(+), 0 deletions(-)

diff --git a/opendj-sdk/opends/src/server/org/opends/server/messages/ToolMessages.java b/opendj-sdk/opends/src/server/org/opends/server/messages/ToolMessages.java
index 2843689..d60cd77 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/messages/ToolMessages.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/messages/ToolMessages.java
@@ -7466,6 +7466,15 @@
 
 
   /**
+   * The message ID for the message that will be used as the description of the
+   * excludeOperational argument.  This does not take any arguments.
+   */
+  public static final int MSGID_LDIFEXPORT_DESCRIPTION_EXCLUDE_OPERATIONAL =
+       CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 785;
+
+
+
+  /**
    * Associates a set of generic messages with the message IDs defined in this
    * class.
    */
@@ -7600,6 +7609,8 @@
     registerMessage(MSGID_LDIFEXPORT_DESCRIPTION_EXCLUDE_FILTER,
                     "Filter to identify entries to exclude from the LDIF " +
                     "export");
+    registerMessage(MSGID_LDIFEXPORT_DESCRIPTION_EXCLUDE_OPERATIONAL,
+                    "Exclude operational attributes from the LDIF export");
     registerMessage(MSGID_LDIFEXPORT_DESCRIPTION_WRAP_COLUMN,
                     "Column at which to wrap long lines (0 for no wrapping)");
     registerMessage(MSGID_LDIFEXPORT_DESCRIPTION_COMPRESS_LDIF,
diff --git a/opendj-sdk/opends/src/server/org/opends/server/tools/ExportLDIF.java b/opendj-sdk/opends/src/server/org/opends/server/tools/ExportLDIF.java
index 90d515e..cd2565e 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/tools/ExportLDIF.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/tools/ExportLDIF.java
@@ -106,6 +106,7 @@
     BooleanArgument compressLDIF            = null;
     BooleanArgument displayUsage            = null;
     BooleanArgument encryptLDIF             = null;
+    BooleanArgument excludeOperationalAttrs = null;
     BooleanArgument signHash                = null;
     IntegerArgument wrapColumn              = null;
     StringArgument  backendID               = null;
@@ -210,6 +211,12 @@
       argParser.addArgument(excludeFilterStrings);
 
 
+      excludeOperationalAttrs =
+           new BooleanArgument("excludeoperational", 'O', "excludeOperational",
+                    MSGID_LDIFEXPORT_DESCRIPTION_EXCLUDE_OPERATIONAL);
+      argParser.addArgument(excludeOperationalAttrs);
+
+
       wrapColumn =
            new IntegerArgument("wrapcolumn", 'w', "wrapColumn", false, false,
                                true, "{wrapColumn}", 0, null, true, 0, false, 0,
@@ -714,6 +721,8 @@
     exportConfig.setIncludeBranches(includeBranches);
     exportConfig.setIncludeFilters(includeFilters);
     exportConfig.setSignHash(signHash.isPresent());
+    exportConfig.setIncludeOperationalAttributes(
+                      (! excludeOperationalAttrs.isPresent()));
 
     // FIXME -- Should this be conditional?
     exportConfig.setInvokeExportPlugins(true);
diff --git a/opendj-sdk/opends/src/server/org/opends/server/types/LDIFExportConfig.java b/opendj-sdk/opends/src/server/org/opends/server/types/LDIFExportConfig.java
index 5dd29ec..1fc9ae0 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/types/LDIFExportConfig.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/types/LDIFExportConfig.java
@@ -636,6 +636,26 @@
 
 
   /**
+   * Specifies whether the set of operational attributes should be
+   * included in the export.
+   *
+   * @param  includeOperationalAttributes  Specifies whether the set
+   *                                       of operational attributes
+   *                                       should be included in the
+   *                                       export.
+   */
+  public void setIncludeOperationalAttributes(
+                   boolean includeOperationalAttributes)
+  {
+    assert debugEnter(CLASS_NAME, "setIncludeOperationalAttributes",
+                      String.valueOf(includeOperationalAttributes));
+
+    this.includeOperationalAttributes = includeOperationalAttributes;
+  }
+
+
+
+  /**
    * Retrieves the set of attributes that should be excluded from the
    * entries written to LDIF.  The set that is returned may be altered
    * by the caller.

--
Gitblit v1.10.0