From d9402bf4faff7b3727d2a500701a05c6d8d32080 Mon Sep 17 00:00:00 2001
From: sin <sin@localhost>
Date: Thu, 08 Mar 2007 22:30:14 +0000
Subject: [PATCH] issue 756:Import LDIF should allow groups of attributes to be included or excluded
---
opends/src/server/org/opends/server/tools/ImportLDIF.java | 49 +++++++++++++++++++++++++++++++++++++++++--------
1 files changed, 41 insertions(+), 8 deletions(-)
diff --git a/opends/src/server/org/opends/server/tools/ImportLDIF.java b/opends/src/server/org/opends/server/tools/ImportLDIF.java
index 2d334f2..eaba2bf 100644
--- a/opends/src/server/org/opends/server/tools/ImportLDIF.java
+++ b/opends/src/server/org/opends/server/tools/ImportLDIF.java
@@ -555,6 +555,8 @@
// See if there were any user-defined sets of include/exclude attributes or
// filters. If so, then process them.
HashSet<AttributeType> excludeAttributes;
+ boolean excludeAllUserAttributes = false;
+ boolean excludeAllOperationalAttributes = false;
if (excludeAttributeStrings == null)
{
excludeAttributes = null;
@@ -565,17 +567,30 @@
for (String attrName : excludeAttributeStrings.getValues())
{
String lowerName = attrName.toLowerCase();
- AttributeType attrType = DirectoryServer.getAttributeType(lowerName);
- if (attrType == null)
+ if(lowerName.equals("*"))
{
- attrType = DirectoryServer.getDefaultAttributeType(attrName);
+ excludeAllUserAttributes = true;
}
+ else if(lowerName.equals("+"))
+ {
+ excludeAllOperationalAttributes = true;
+ }
+ else
+ {
+ AttributeType attrType = DirectoryServer.getAttributeType(lowerName);
+ if (attrType == null)
+ {
+ attrType = DirectoryServer.getDefaultAttributeType(attrName);
+ }
- excludeAttributes.add(attrType);
+ excludeAttributes.add(attrType);
+ }
}
}
HashSet<AttributeType> includeAttributes;
+ boolean includeAllUserAttributes = false;
+ boolean includeAllOperationalAttributes = false;
if (includeAttributeStrings == null)
{
includeAttributes = null;
@@ -586,13 +601,24 @@
for (String attrName : includeAttributeStrings.getValues())
{
String lowerName = attrName.toLowerCase();
- AttributeType attrType = DirectoryServer.getAttributeType(lowerName);
- if (attrType == null)
+ if(lowerName.equals("*"))
{
- attrType = DirectoryServer.getDefaultAttributeType(attrName);
+ includeAllUserAttributes = true;
}
+ else if(lowerName.equals("+"))
+ {
+ includeAllOperationalAttributes = true;
+ }
+ else
+ {
+ AttributeType attrType = DirectoryServer.getAttributeType(lowerName);
+ if (attrType == null)
+ {
+ attrType = DirectoryServer.getDefaultAttributeType(attrName);
+ }
- includeAttributes.add(attrType);
+ includeAttributes.add(attrType);
+ }
}
}
@@ -889,6 +915,13 @@
importConfig.setIncludeFilters(includeFilters);
importConfig.setValidateSchema(!skipSchemaValidation.isPresent());
importConfig.setBufferSize(LDIF_BUFFER_SIZE);
+ importConfig.setExcludeAllUserAttributes(
+ excludeAllUserAttributes);
+ importConfig.setExcludeAllOperationalAttributes(
+ excludeAllOperationalAttributes);
+ importConfig.setIncludeAllOpAttributes(
+ includeAllOperationalAttributes);
+ importConfig.setIncludeAllUserAttributes(includeAllUserAttributes);
// FIXME -- Should this be conditional?
importConfig.setInvokeImportPlugins(true);
--
Gitblit v1.10.0