From e1ea3e0d8999105f144d2be98e0286928b8319ed Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Tue, 03 Apr 2007 18:52:11 +0000
Subject: [PATCH] Add initial support for a virtual attribute subsystem, and implement a few different kinds of virtual attributes.  This commit addresses the following issues:

---
 opends/src/server/org/opends/server/core/SearchOperation.java |   32 ++++++++++++++++++++++++++++----
 1 files changed, 28 insertions(+), 4 deletions(-)

diff --git a/opends/src/server/org/opends/server/core/SearchOperation.java b/opends/src/server/org/opends/server/core/SearchOperation.java
index 45f54d3..7d4f2f7 100644
--- a/opends/src/server/org/opends/server/core/SearchOperation.java
+++ b/opends/src/server/org/opends/server/core/SearchOperation.java
@@ -102,9 +102,6 @@
                   PostOperationSearchOperation, PostResponseSearchOperation,
                   SearchEntrySearchOperation, SearchReferenceSearchOperation
 {
-
-
-
   // Indicates whether a search result done response has been sent to the
   // client.
   private AtomicBoolean responseSent;
@@ -116,12 +113,18 @@
   // entries.
   private boolean includeUsableControl;
 
+  // Indicates whether to only real attributes should be returned.
+  private boolean realAttributesOnly;
+
   // Indicates whether LDAP subentries should be returned.
   private boolean returnLDAPSubentries;
 
   // Indicates whether to include attribute types only or both types and values.
   private boolean typesOnly;
 
+  // Indicates whether to only virtual attributes should be returned.
+  private boolean virtualAttributesOnly;
+
   // The raw, unprocessed base DN as included in the request from the client.
   private ByteString rawBaseDN;
 
@@ -274,6 +277,8 @@
     persistentSearch       = null;
     returnLDAPSubentries   = false;
     matchedValuesControl   = null;
+    realAttributesOnly     = false;
+    virtualAttributesOnly  = false;
   }
 
 
@@ -865,7 +870,8 @@
     Entry entryToReturn;
     if ((attributes == null) || attributes.isEmpty())
     {
-      entryToReturn = entry.duplicateWithoutOperationalAttributes(typesOnly);
+      entryToReturn = entry.duplicateWithoutOperationalAttributes(typesOnly,
+                                                                  true);
     }
     else
     {
@@ -1028,6 +1034,16 @@
     }
 
 
+    if (realAttributesOnly)
+    {
+      entryToReturn.stripVirtualAttributes();
+    }
+    else if (virtualAttributesOnly)
+    {
+      entryToReturn.stripRealAttributes();
+    }
+
+
     // If there is a matched values control, then further pare down the entry
     // based on the filters that it contains.
     if ((matchedValuesControl != null) && (! typesOnly))
@@ -1877,6 +1893,14 @@
           {
             includeUsableControl = true;
           }
+          else if (oid.equals(OID_REAL_ATTRS_ONLY))
+          {
+            realAttributesOnly = true;
+          }
+          else if (oid.equals(OID_VIRTUAL_ATTRS_ONLY))
+          {
+            virtualAttributesOnly = true;
+          }
 
           // NYI -- Add support for additional controls.
           else if (c.isCritical())

--
Gitblit v1.10.0