mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Matthew Swift
26.12.2012 58ffacee660a4eb792f49dd311a4e2ddda05afad
opendj3/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/ComplexAttributeMapper.java
@@ -51,35 +51,17 @@
     */
    public ComplexAttributeMapper(String jsonAttributeName, AttributeMapper mapper) {
        this.jsonAttributeName = jsonAttributeName;
        this.normalizedJsonAttributeName = toLowerCase(jsonAttributeName);
        this.mapper = mapper;
        this.normalizedJsonAttributeName = toLowerCase(jsonAttributeName);
    }
    /**
     * {@inheritDoc}
     */
    public void getLDAPAttributes(Set<String> ldapAttributes) {
        mapper.getLDAPAttributes(ldapAttributes);
    }
    /**
     * {@inheritDoc}
     */
    public void getLDAPAttributes(Set<String> ldapAttributes, JsonPointer resourceAttribute) {
        if (resourceAttribute.size() > 0) {
            String rootName = resourceAttribute.get(0);
            if (toLowerCase(rootName).equals(normalizedJsonAttributeName)) {
                JsonPointer relativePointer = resourceAttribute.relativePointer();
                if (relativePointer == null) {
                    // User requested the entire contents of this complex
                    // attribute.
                    mapper.getLDAPAttributes(ldapAttributes);
                } else {
                    // User requested partial contents of this complex
                    // attribute.
                    mapper.getLDAPAttributes(ldapAttributes, relativePointer);
                }
            }
    public void getLDAPAttributes(JsonPointer jsonAttribute, Set<String> ldapAttributes) {
        if (attributeMatchesPointer(jsonAttribute)) {
            JsonPointer relativePointer = jsonAttribute.relativePointer();
            mapper.getLDAPAttributes(relativePointer, ldapAttributes);
        }
    }
@@ -112,4 +94,9 @@
    }
    private boolean attributeMatchesPointer(JsonPointer resourceAttribute) {
        return resourceAttribute.isEmpty()
                || toLowerCase(resourceAttribute.get(0)).equals(normalizedJsonAttributeName);
    }
}