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

Violette Roche-Montane
15.10.2014 5c054a37283931731e6feb4fd5b1b99ad59f9058
Code cleanup on from(Scope) - Replaced if...else.. by the switch(enum).
1 files modified
17 ■■■■ changed files
opendj-server3x-adapter/src/main/java/org/forgerock/opendj/adapter/server3x/Converters.java 17 ●●●● patch | view | raw | blame | history
opendj-server3x-adapter/src/main/java/org/forgerock/opendj/adapter/server3x/Converters.java
@@ -588,18 +588,19 @@
     *          The server scope value.
     * @return The SDK scope value.
     */
    public static SearchScope from(
            org.opends.server.admin.std.meta.VirtualAttributeCfgDefn.Scope srvScope) {
        if (srvScope != null && srvScope.name() != null) {
            final String srvScopeName = srvScope.name().toLowerCase();
            if ("base_object".equals(srvScopeName)) {
    public static SearchScope from(org.opends.server.admin.std.meta.VirtualAttributeCfgDefn.Scope srvScope) {
        if (srvScope != null) {
            switch (srvScope) {
            case BASE_OBJECT:
                return SearchScope.BASE_OBJECT;
            } else if ("single_level".equals(srvScopeName)) {
            case SINGLE_LEVEL:
                return SearchScope.SINGLE_LEVEL;
            } else if ("subordinate_subtree".equals(srvScopeName)) {
            case SUBORDINATE_SUBTREE:
                return SearchScope.SUBORDINATES;
            } else if ("whole_subtree".equals(srvScopeName)) {
            case WHOLE_SUBTREE:
                return SearchScope.WHOLE_SUBTREE;
            default:
                return null;
            }
        }
        return null;