From d89aacc0431eab3dce367e8fe9575eb8f83aa535 Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Fri, 08 Feb 2013 11:37:59 +0000
Subject: [PATCH] Checkpoint changes: clean up APIs, separate out MVCC and naming strategies.

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

diff --git a/opendj3/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/DefaultAttributeMapper.java b/opendj3/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/DefaultAttributeMapper.java
index 8314c1b..7c8fe43 100644
--- a/opendj3/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/DefaultAttributeMapper.java
+++ b/opendj3/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/DefaultAttributeMapper.java
@@ -36,7 +36,7 @@
  * An attribute mapper that directly maps a configurable selection of attributes
  * to and from LDAP without any transformation.
  */
-public final class DefaultAttributeMapper implements AttributeMapper {
+final class DefaultAttributeMapper extends AttributeMapper {
     // All user attributes by default.
     private final Map<String, String> excludedAttributes = new LinkedHashMap<String, String>();
     private final Map<String, String> includedAttributes = new LinkedHashMap<String, String>();
@@ -45,7 +45,7 @@
      * Creates a new default attribute mapper which will map all user attributes
      * to JSON by default.
      */
-    public DefaultAttributeMapper() {
+    DefaultAttributeMapper() {
         // No implementation required.
     }
 
@@ -56,18 +56,15 @@
      *            The attributes to be excluded.
      * @return This attribute mapper.
      */
-    public DefaultAttributeMapper excludeAttribute(final String... attributes) {
+    DefaultAttributeMapper excludeAttribute(final String... attributes) {
         for (final String attribute : attributes) {
             excludedAttributes.put(toLowerCase(attribute), attribute);
         }
         return this;
     }
 
-    /**
-     * {@inheritDoc}
-     */
     @Override
-    public void getLDAPAttributes(final Context c, final JsonPointer jsonAttribute,
+    void getLDAPAttributes(final Context c, final JsonPointer jsonAttribute,
             final Set<String> ldapAttributes) {
         switch (jsonAttribute.size()) {
         case 0:
@@ -88,13 +85,9 @@
         }
     }
 
-    /**
-     * {@inheritDoc}
-     */
     @Override
-    public void getLDAPFilter(final Context c, final FilterType type,
-            final JsonPointer jsonAttribute, final String operator, final Object valueAssertion,
-            final ResultHandler<Filter> h) {
+    void getLDAPFilter(final Context c, final FilterType type, final JsonPointer jsonAttribute,
+            final String operator, final Object valueAssertion, final ResultHandler<Filter> h) {
         if (jsonAttribute.size() == 1 && isIncludedAttribute(jsonAttribute.get(0))) {
             h.handleResult(toFilter(c, type, jsonAttribute.get(0), valueAssertion));
         } else {
@@ -110,18 +103,17 @@
      *            The attributes to be included.
      * @return This attribute mapper.
      */
-    public DefaultAttributeMapper includeAttribute(final String... attributes) {
+    DefaultAttributeMapper includeAttribute(final String... attributes) {
         for (final String attribute : attributes) {
             includedAttributes.put(toLowerCase(attribute), attribute);
         }
         return this;
     }
 
-    /**
-     * {@inheritDoc}
-     */
     @Override
-    public void toJSON(final Context c, final Entry e, final ResultHandler<Map<String, Object>> h) {
+    void toJSON(final Context c, final Entry e, final ResultHandler<Map<String, Object>> h) {
+        // FIXME: this will leave out attributes which were not included in the LDAP entry. We should
+        // ensure that JSON attributes are present, even if they are null or an empty array.
         final Map<String, Object> result = new LinkedHashMap<String, Object>(e.getAttributeCount());
         for (final Attribute a : e.getAllAttributes()) {
             final String name = getAttributeName(a);
@@ -132,11 +124,8 @@
         h.handleResult(result);
     }
 
-    /**
-     * {@inheritDoc}
-     */
     @Override
-    public void toLDAP(final Context c, final JsonValue v, final ResultHandler<List<Attribute>> h) {
+    void toLDAP(final Context c, final JsonValue v, final ResultHandler<List<Attribute>> h) {
         // TODO:
     }
 

--
Gitblit v1.10.0