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

Jean-Noël Rouvignac
13.26.2016 4a164f90a4bab55c79314343d6127570a8fbed10
opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/Resource.java
@@ -60,6 +60,7 @@
import org.forgerock.api.models.Services;
import org.forgerock.api.models.Update;
import org.forgerock.http.ApiProducer;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.LocalizedIllegalArgumentException;
import org.forgerock.json.JsonPointer;
import org.forgerock.json.JsonValue;
@@ -128,12 +129,23 @@
    private volatile Boolean hasSubTypesWithSubResources = null;
    /** The set of actions supported by this resource and its sub-types. */
    private final Set<Action> supportedActions = new HashSet<>();
    private LocalizableMessage description;
    Resource(final String id) {
        this.id = id;
    }
    /**
     * Sets the description of this resource.
     *
     * @param description
     *          the description of this resource
     */
    public void description(LocalizableMessage description) {
        this.description = description;
    }
    /**
     * Returns the resource ID of this resource.
     *
     * @return The resource ID of this resource.
@@ -507,6 +519,8 @@
        org.forgerock.api.models.Resource.Builder resource = org.forgerock.api.models.Resource.
            resource()
            .title(id)
            .description(toLS(description))
            .resourceSchema(schemaRef("#/definitions/" + id))
            .mvccSupported(isMvccSupported());
@@ -522,6 +536,7 @@
        return ApiDescription.apiDescription()
                      .id("unused").version("unused")
                      .definitions(definitions())
                      .paths(getPaths())
                      .errors(errors())
                      .build();
    }
@@ -536,6 +551,8 @@
    ApiDescription collectionApi(boolean isReadOnly) {
        org.forgerock.api.models.Resource.Builder resource = org.forgerock.api.models.Resource.
            resource()
            .title(id)
            .description(toLS(description))
            .resourceSchema(schemaRef("#/definitions/" + id))
            .mvccSupported(isMvccSupported());
@@ -584,6 +601,16 @@
        return definitions.build();
    }
    private LocalizableString toLS(LocalizableMessage msg) {
        if (msg != null) {
            if (msg.resourceName() != null) {
                return new LocalizableString("i18n:" + msg.resourceName() + "#" /* TODO + msg.getKey() */);
            }
            return new LocalizableString(msg.toString());
        }
        return null;
    }
    /**
     * Returns the api description that describes a resource with sub resources.
     *