From 9cb4730adfb2ad5fcf171c48a4d0aee46777902e Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Wed, 23 May 2012 10:06:17 +0000
Subject: [PATCH] * simplify example code and add groups container * allow AttributeMappers to throw ResourceExceptions instead of LDAP ErrorResultExceptions * rename IdentityAttributeMapper -> SimpleAttributeMapper.

---
 opendj3/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/LDAPResource.java |   22 +++++++++++-----------
 1 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/opendj3/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/LDAPResource.java b/opendj3/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/LDAPResource.java
index 58fdbc8..a0fe6f0 100644
--- a/opendj3/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/LDAPResource.java
+++ b/opendj3/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/LDAPResource.java
@@ -160,14 +160,13 @@
 
                         public void handleResult(final SearchResultEntry entry) {
                             final String revision = entryContainer.getEtagFromEntry(entry);
-                            final ResultHandler<Map<String, Object>> mapHandler =
-                                    new ResultHandler<Map<String, Object>>() {
-                                        public void handleErrorResult(
-                                                final ErrorResultException error) {
-                                            out.setFailure(adaptErrorResult(error));
+                            final AttributeMapperCompletionHandler<Map<String, Object>> mapHandler =
+                                    new AttributeMapperCompletionHandler<Map<String, Object>>() {
+                                        public void onFailure(final ResourceException e) {
+                                            out.setFailure(e);
                                         }
 
-                                        public void handleResult(final Map<String, Object> result) {
+                                        public void onSuccess(final Map<String, Object> result) {
                                             out.setResult(id, revision, new JsonValue(result));
                                         }
                                     };
@@ -227,18 +226,19 @@
      *         attributes.
      */
     private Collection<String> getRequestedLDAPAttributes(final Set<JsonPointer> requestedAttributes) {
+        final Set<String> requestedLDAPAttributes;
         if (requestedAttributes.isEmpty()) {
             // Full read.
-            return attributeMapper.getAllLDAPAttributes();
+            requestedLDAPAttributes = new LinkedHashSet<String>();
+            attributeMapper.getLDAPAttributes(requestedLDAPAttributes);
         } else {
             // Partial read.
-            final Set<String> requestedLDAPAttributes =
-                    new LinkedHashSet<String>(requestedAttributes.size());
+            requestedLDAPAttributes = new LinkedHashSet<String>(requestedAttributes.size());
             for (final JsonPointer requestedAttribute : requestedAttributes) {
-                attributeMapper.getLDAPAttributesFor(requestedAttribute, requestedLDAPAttributes);
+                attributeMapper.getLDAPAttributes(requestedLDAPAttributes, requestedAttribute);
             }
-            return requestedLDAPAttributes;
         }
+        return requestedLDAPAttributes;
     }
 
 }

--
Gitblit v1.10.0