You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by il...@apache.org on 2015/11/25 12:26:07 UTC

[4/5] syncope git commit: Cleaning up invalid AnyObjectService#list (with no params) method, and adjusting CLI accordingly

Cleaning up invalid AnyObjectService#list (with no params) method, and adjusting CLI accordingly


Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/0f938e72
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/0f938e72
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/0f938e72

Branch: refs/heads/master
Commit: 0f938e72d6723517fe451010ec3a2e398b3e4ecc
Parents: bbb051f
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Wed Nov 25 12:07:53 2015 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Wed Nov 25 12:09:02 2015 +0100

----------------------------------------------------------------------
 .../cli/commands/any/AbstractAnyCommand.java    |  27 -----
 .../client/cli/commands/any/AnyCommand.java     | 111 -------------------
 .../client/cli/commands/any/AnyDelete.java      |  59 ----------
 .../client/cli/commands/any/AnyList.java        |  50 ---------
 .../client/cli/commands/any/AnyRead.java        |  58 ----------
 ...yReadAttributeBySchemaTypeAndSchemaName.java |  61 ----------
 .../any/AnyReadAttributesBySchemaType.java      |  64 -----------
 .../cli/commands/any/AnyResultManager.java      |  80 -------------
 .../cli/commands/any/AnySyncopeOperations.java  |  53 ---------
 .../anyobject/AbstractAnyObjectCommand.java     |  27 +++++
 .../commands/anyobject/AnyObjectCommand.java    | 111 +++++++++++++++++++
 .../cli/commands/anyobject/AnyObjectDelete.java |  59 ++++++++++
 .../cli/commands/anyobject/AnyObjectList.java   |  50 +++++++++
 .../cli/commands/anyobject/AnyObjectRead.java   |  58 ++++++++++
 ...tReadAttributeBySchemaTypeAndSchemaName.java |  61 ++++++++++
 .../AnyObjectReadAttributesBySchemaType.java    |  64 +++++++++++
 .../anyobject/AnyObjectResultManager.java       |  80 +++++++++++++
 .../anyobject/AnyObjectSyncopeOperations.java   |  53 +++++++++
 .../common/rest/api/service/AnyService.java     |  11 --
 .../common/rest/api/service/GroupService.java   |  13 +++
 .../common/rest/api/service/UserService.java    |  14 +++
 .../rest/cxf/service/AbstractAnyService.java    |  11 +-
 .../core/rest/cxf/service/GroupServiceImpl.java |   7 ++
 .../core/rest/cxf/service/UserServiceImpl.java  |   7 ++
 24 files changed, 609 insertions(+), 580 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/0f938e72/client/cli/src/main/java/org/apache/syncope/client/cli/commands/any/AbstractAnyCommand.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/any/AbstractAnyCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/any/AbstractAnyCommand.java
deleted file mode 100644
index dc62ba9..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/any/AbstractAnyCommand.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.any;
-
-public abstract class AbstractAnyCommand {
-
-    protected final AnySyncopeOperations anySyncopeOperations = new AnySyncopeOperations();
-
-    protected final AnyResultManager anyResultManager = new AnyResultManager();
-
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/0f938e72/client/cli/src/main/java/org/apache/syncope/client/cli/commands/any/AnyCommand.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/any/AnyCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/any/AnyCommand.java
deleted file mode 100644
index c4b2159..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/any/AnyCommand.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.any;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.syncope.client.cli.Command;
-import org.apache.syncope.client.cli.Input;
-import org.apache.syncope.client.cli.commands.AbstractCommand;
-
-@Command(name = "any")
-public class AnyCommand extends AbstractCommand {
-
-    private final AnyResultManager anyResultManager = new AnyResultManager();
-
-    @Override
-    public void execute(final Input input) {
-        if (StringUtils.isBlank(input.getOption())) {
-            input.setOption(AnyOptions.HELP.getOptionName());
-        }
-        switch (AnyOptions.fromName(input.getOption())) {
-            case DETAILS:
-                break;
-            case LIST:
-                new AnyList(input).list();
-                break;
-            case READ:
-                new AnyRead(input).read();
-                break;
-            case READ_ATTRIBUTES_BY_SCHEMA:
-                new AnyReadAttributeBySchemaTypeAndSchemaName(input).read();
-                break;
-            case READ_ATTRIBUTES_BY_SCHEMA_TYPE:
-                new AnyReadAttributesBySchemaType(input).read();
-                break;
-            case DELETE:
-                new AnyDelete(input).delete();
-                break;
-            case HELP:
-                System.out.println(getHelpMessage());
-                break;
-            default:
-                anyResultManager.defaultOptionMessage(input.getOption(), getHelpMessage());
-        }
-    }
-
-    @Override
-    public String getHelpMessage() {
-        return anyResultManager.commandHelpMessage(getClass());
-    }
-
-    private enum AnyOptions {
-
-        HELP("--help"),
-        DETAILS("--details"),
-        LIST("--list"),
-        READ("--read"),
-        READ_ATTRIBUTES_BY_SCHEMA("--read-attr-by-schema"),
-        READ_ATTRIBUTES_BY_SCHEMA_TYPE("--read-attr-by-schema-type"),
-        DELETE("--delete");
-
-        private final String optionName;
-
-        AnyOptions(final String optionName) {
-            this.optionName = optionName;
-        }
-
-        public String getOptionName() {
-            return optionName;
-        }
-
-        public boolean equalsOptionName(final String otherName) {
-            return (otherName == null) ? false : optionName.equals(otherName);
-        }
-
-        public static AnyOptions fromName(final String name) {
-            AnyOptions optionToReturn = HELP;
-            for (final AnyOptions option : AnyOptions.values()) {
-                if (option.equalsOptionName(name)) {
-                    optionToReturn = option;
-                }
-            }
-            return optionToReturn;
-        }
-
-        public static List<String> toList() {
-            final List<String> options = new ArrayList<>();
-            for (final AnyOptions value : values()) {
-                options.add(value.getOptionName());
-            }
-            return options;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/0f938e72/client/cli/src/main/java/org/apache/syncope/client/cli/commands/any/AnyDelete.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/any/AnyDelete.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/any/AnyDelete.java
deleted file mode 100644
index 170cb57..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/any/AnyDelete.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.any;
-
-import org.apache.syncope.client.cli.Input;
-import org.apache.syncope.common.lib.SyncopeClientException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class AnyDelete extends AbstractAnyCommand {
-
-    private static final Logger LOG = LoggerFactory.getLogger(AnyDelete.class);
-
-    private static final String DELETE_HELP_MESSAGE = "any --delete {ANY-ID} {ANY-ID} [...]";
-
-    private final Input input;
-
-    public AnyDelete(final Input input) {
-        this.input = input;
-    }
-
-    public void delete() {
-        if (input.parameterNumber() >= 1) {
-            for (final String parameter : input.getParameters()) {
-                try {
-                    anySyncopeOperations.delete(parameter);
-                    anyResultManager.deletedMessage("Any", parameter);
-                } catch (final SyncopeClientException ex) {
-                    LOG.error("Error deleting group", ex);
-                    if (ex.getMessage().startsWith("NotFound")) {
-                        anyResultManager.notFoundError("any", parameter);
-                    } else {
-                        anyResultManager.genericError(ex.getMessage());
-                    }
-                } catch (final NumberFormatException ex) {
-                    anyResultManager.numberFormatException("any", parameter);
-                }
-            }
-        } else {
-            anyResultManager.commandOptionError(DELETE_HELP_MESSAGE);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/0f938e72/client/cli/src/main/java/org/apache/syncope/client/cli/commands/any/AnyList.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/any/AnyList.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/any/AnyList.java
deleted file mode 100644
index 5b2ee56..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/any/AnyList.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.any;
-
-import org.apache.syncope.client.cli.Input;
-import org.apache.syncope.common.lib.SyncopeClientException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class AnyList extends AbstractAnyCommand {
-
-    private static final Logger LOG = LoggerFactory.getLogger(AnyList.class);
-
-    private static final String LIST_HELP_MESSAGE = "any --list";
-
-    private final Input input;
-
-    public AnyList(final Input input) {
-        this.input = input;
-    }
-
-    public void list() {
-        if (input.parameterNumber() == 0) {
-            try {
-                anyResultManager.printAnys(anySyncopeOperations.list());
-            } catch (final SyncopeClientException ex) {
-                LOG.error("Error listing any object", ex);
-                anyResultManager.genericError(ex.getMessage());
-            }
-        } else {
-            anyResultManager.unnecessaryParameters(input.listParameters(), LIST_HELP_MESSAGE);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/0f938e72/client/cli/src/main/java/org/apache/syncope/client/cli/commands/any/AnyRead.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/any/AnyRead.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/any/AnyRead.java
deleted file mode 100644
index ca50b91..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/any/AnyRead.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.any;
-
-import org.apache.syncope.client.cli.Input;
-import org.apache.syncope.common.lib.SyncopeClientException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class AnyRead extends AbstractAnyCommand {
-
-    private static final Logger LOG = LoggerFactory.getLogger(AnyRead.class);
-
-    private static final String READ_HELP_MESSAGE = "any --read {ANY-ID} {ANY-ID} [...]";
-
-    private final Input input;
-
-    public AnyRead(final Input input) {
-        this.input = input;
-    }
-
-    public void read() {
-        if (input.parameterNumber() >= 1) {
-            for (final String parameter : input.getParameters()) {
-                try {
-                    anyResultManager.printGroup(anySyncopeOperations.read(parameter));
-                } catch (final SyncopeClientException ex) {
-                    LOG.error("Error reading group", ex);
-                    if (ex.getMessage().startsWith("NotFound")) {
-                        anyResultManager.notFoundError("Any object", parameter);
-                    } else {
-                        anyResultManager.genericError(ex.getMessage());
-                    }
-                } catch (final NumberFormatException ex) {
-                    anyResultManager.numberFormatException("any object", parameter);
-                }
-            }
-        } else {
-            anyResultManager.commandOptionError(READ_HELP_MESSAGE);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/0f938e72/client/cli/src/main/java/org/apache/syncope/client/cli/commands/any/AnyReadAttributeBySchemaTypeAndSchemaName.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/any/AnyReadAttributeBySchemaTypeAndSchemaName.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/any/AnyReadAttributeBySchemaTypeAndSchemaName.java
deleted file mode 100644
index b1cd414..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/any/AnyReadAttributeBySchemaTypeAndSchemaName.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.any;
-
-import org.apache.syncope.client.cli.Input;
-import org.apache.syncope.client.cli.util.CommandUtils;
-import org.apache.syncope.common.lib.SyncopeClientException;
-import org.apache.syncope.common.lib.types.SchemaType;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class AnyReadAttributeBySchemaTypeAndSchemaName extends AbstractAnyCommand {
-
-    private static final Logger LOG = LoggerFactory.getLogger(AnyReadAttributeBySchemaTypeAndSchemaName.class);
-
-    private static final String READ_HELP_MESSAGE
-            = "any --read-attr-by-schema {ANY-ID} {SCHEMA-TYPE} {SCHEMA-NAME}\n"
-            + "   Schema type: PLAIN / DERIVED / VIRTUAL";
-
-    private final Input input;
-
-    public AnyReadAttributeBySchemaTypeAndSchemaName(final Input input) {
-        this.input = input;
-    }
-
-    public void read() {
-        if (input.parameterNumber() == 3) {
-            try {
-                anyResultManager.printAttribute(anySyncopeOperations.readAttribute(
-                        input.firstParameter(), input.secondParameter(), input.thirdParameter()));
-            } catch (final SyncopeClientException ex) {
-                LOG.error("Error reading any object", ex);
-                anyResultManager.genericError(ex.getMessage());
-            } catch (final NumberFormatException ex) {
-                anyResultManager.numberFormatException("any object", input.firstParameter());
-            } catch (final IllegalArgumentException ex) {
-                LOG.error("Error reading schema", ex);
-                anyResultManager.typeNotValidError(
-                        "schema", input.secondParameter(), CommandUtils.fromEnumToArray(SchemaType.class));
-            }
-        } else {
-            anyResultManager.commandOptionError(READ_HELP_MESSAGE);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/0f938e72/client/cli/src/main/java/org/apache/syncope/client/cli/commands/any/AnyReadAttributesBySchemaType.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/any/AnyReadAttributesBySchemaType.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/any/AnyReadAttributesBySchemaType.java
deleted file mode 100644
index 602c68f..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/any/AnyReadAttributesBySchemaType.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.any;
-
-import org.apache.syncope.client.cli.Input;
-import org.apache.syncope.client.cli.util.CommandUtils;
-import org.apache.syncope.common.lib.SyncopeClientException;
-import org.apache.syncope.common.lib.types.SchemaType;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class AnyReadAttributesBySchemaType extends AbstractAnyCommand {
-
-    private static final Logger LOG = LoggerFactory.getLogger(AnyReadAttributesBySchemaType.class);
-
-    private static final String READ_HELP_MESSAGE = "any --read-attr-by-schema-type {ANY-ID} {SCHEMA-TYPE}\n"
-            + "   Schema type: PLAIN / DERIVED / VIRTUAL";
-
-    private final Input input;
-
-    public AnyReadAttributesBySchemaType(final Input input) {
-        this.input = input;
-    }
-
-    public void read() {
-        if (input.parameterNumber() == 2) {
-            try {
-                anyResultManager.printAttributes(anySyncopeOperations.readAttributes(
-                        input.firstParameter(), input.secondParameter()));
-            } catch (final SyncopeClientException ex) {
-                LOG.error("Error reading any", ex);
-                if (ex.getMessage().startsWith("NotFound")) {
-                    anyResultManager.notFoundError("Any", input.firstParameter());
-                } else {
-                    anyResultManager.genericError(ex.getMessage());
-                }
-            } catch (final NumberFormatException ex) {
-                anyResultManager.numberFormatException("any", input.firstParameter());
-            } catch (final IllegalArgumentException ex) {
-                LOG.error("Error reading schema", ex);
-                anyResultManager.typeNotValidError(
-                        "schema", input.secondParameter(), CommandUtils.fromEnumToArray(SchemaType.class));
-            }
-        } else {
-            anyResultManager.commandOptionError(READ_HELP_MESSAGE);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/0f938e72/client/cli/src/main/java/org/apache/syncope/client/cli/commands/any/AnyResultManager.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/any/AnyResultManager.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/any/AnyResultManager.java
deleted file mode 100644
index 3b50406..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/any/AnyResultManager.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.any;
-
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import org.apache.syncope.client.cli.commands.CommonsResultManager;
-import org.apache.syncope.common.lib.to.AnyObjectTO;
-import org.apache.syncope.common.lib.to.AttrTO;
-
-public class AnyResultManager extends CommonsResultManager {
-
-    public void printAnys(final List<AnyObjectTO> anyObjectTOs) {
-        System.out.println("");
-        for (final AnyObjectTO anyObjectTO : anyObjectTOs) {
-            printGroup(anyObjectTO);
-        }
-    }
-
-    public void printGroup(final AnyObjectTO anyObjectTO) {
-        System.out.println(" > ANY ID: " + anyObjectTO.getKey());
-        System.out.println("    type: " + anyObjectTO.getType());
-        System.out.println("    realm: " + anyObjectTO.getRealm());
-        System.out.println("    status: " + anyObjectTO.getStatus());
-        System.out.println("    RESOURCES: ");
-        printResources(anyObjectTO.getResources());
-        System.out.println("    PLAIN ATTRIBUTES: ");
-        printAttributes(anyObjectTO.getPlainAttrs());
-        System.out.println("    DERIVED ATTRIBUTES: ");
-        printAttributes(anyObjectTO.getDerAttrs());
-        System.out.println("    VIRTUAL ATTRIBUTES: ");
-        printAttributes(anyObjectTO.getVirAttrs());
-    }
-
-    private void printResources(final Set<String> resources) {
-        for (final String resource : resources) {
-            System.out.println("      - " + resource);
-        }
-    }
-
-    public void printAttributes(final Set<AttrTO> attributes) {
-        for (final AttrTO attribute : attributes) {
-            printAttribute(attribute);
-        }
-        System.out.println("");
-    }
-
-    public void printAttribute(final AttrTO attribute) {
-        final StringBuilder attributeMessageBuilder = new StringBuilder();
-        attributeMessageBuilder.append("     - ")
-                .append(attribute.getSchema())
-                .append(": ")
-                .append(attribute.getValues());
-        if (attribute.isReadonly()) {
-            attributeMessageBuilder.append(" - is readonly");
-        }
-        System.out.println(attributeMessageBuilder.toString());
-    }
-
-    public void printDetails(final Map<String, String> details) {
-        printDetails("groups details", details);
-    }
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/0f938e72/client/cli/src/main/java/org/apache/syncope/client/cli/commands/any/AnySyncopeOperations.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/any/AnySyncopeOperations.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/any/AnySyncopeOperations.java
deleted file mode 100644
index 5156952..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/any/AnySyncopeOperations.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.any;
-
-import java.util.List;
-import java.util.Set;
-import org.apache.syncope.client.cli.SyncopeServices;
-import org.apache.syncope.common.lib.to.AnyObjectTO;
-import org.apache.syncope.common.lib.to.AttrTO;
-import org.apache.syncope.common.lib.types.SchemaType;
-import org.apache.syncope.common.rest.api.beans.AnyListQuery;
-import org.apache.syncope.common.rest.api.service.AnyObjectService;
-
-public class AnySyncopeOperations {
-
-    private final AnyObjectService anyObjectService = SyncopeServices.get(AnyObjectService.class);
-
-    public List<AnyObjectTO> list() {
-        return anyObjectService.list(new AnyListQuery()).getResult();
-    }
-
-    public AnyObjectTO read(final String anyId) {
-        return anyObjectService.read(Long.valueOf(anyId));
-    }
-
-    public Set<AttrTO> readAttributes(final String anyId, final String schemaType) {
-        return anyObjectService.read(Long.valueOf(anyId), SchemaType.valueOf(schemaType));
-    }
-
-    public AttrTO readAttribute(final String anyId, final String schemaType, final String schema) {
-        return anyObjectService.read(Long.valueOf(anyId), SchemaType.valueOf(schemaType), schema);
-    }
-
-    public void delete(final String anyId) {
-        anyObjectService.delete(Long.valueOf(anyId));
-    }
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/0f938e72/client/cli/src/main/java/org/apache/syncope/client/cli/commands/anyobject/AbstractAnyObjectCommand.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/anyobject/AbstractAnyObjectCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/anyobject/AbstractAnyObjectCommand.java
new file mode 100644
index 0000000..b78b772
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/anyobject/AbstractAnyObjectCommand.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.client.cli.commands.anyobject;
+
+public abstract class AbstractAnyObjectCommand {
+
+    protected final AnyObjectSyncopeOperations anySyncopeOperations = new AnyObjectSyncopeOperations();
+
+    protected final AnyObjectResultManager anyResultManager = new AnyObjectResultManager();
+
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/0f938e72/client/cli/src/main/java/org/apache/syncope/client/cli/commands/anyobject/AnyObjectCommand.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/anyobject/AnyObjectCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/anyobject/AnyObjectCommand.java
new file mode 100644
index 0000000..6dc6ba7
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/anyobject/AnyObjectCommand.java
@@ -0,0 +1,111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.client.cli.commands.anyobject;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.syncope.client.cli.Command;
+import org.apache.syncope.client.cli.Input;
+import org.apache.syncope.client.cli.commands.AbstractCommand;
+
+@Command(name = "anyObject")
+public class AnyObjectCommand extends AbstractCommand {
+
+    private final AnyObjectResultManager anyObjectResultManager = new AnyObjectResultManager();
+
+    @Override
+    public void execute(final Input input) {
+        if (StringUtils.isBlank(input.getOption())) {
+            input.setOption(AnyObjectOptions.HELP.getOptionName());
+        }
+        switch (AnyObjectOptions.fromName(input.getOption())) {
+            case DETAILS:
+                break;
+            case LIST:
+                new AnyObjectList(input).list();
+                break;
+            case READ:
+                new AnyObjectRead(input).read();
+                break;
+            case READ_ATTRIBUTES_BY_SCHEMA:
+                new AnyObjectReadAttributeBySchemaTypeAndSchemaName(input).read();
+                break;
+            case READ_ATTRIBUTES_BY_SCHEMA_TYPE:
+                new AnyObjectReadAttributesBySchemaType(input).read();
+                break;
+            case DELETE:
+                new AnyObjectDelete(input).delete();
+                break;
+            case HELP:
+                System.out.println(getHelpMessage());
+                break;
+            default:
+                anyObjectResultManager.defaultOptionMessage(input.getOption(), getHelpMessage());
+        }
+    }
+
+    @Override
+    public String getHelpMessage() {
+        return anyObjectResultManager.commandHelpMessage(getClass());
+    }
+
+    private enum AnyObjectOptions {
+
+        HELP("--help"),
+        DETAILS("--details"),
+        LIST("--list"),
+        READ("--read"),
+        READ_ATTRIBUTES_BY_SCHEMA("--read-attr-by-schema"),
+        READ_ATTRIBUTES_BY_SCHEMA_TYPE("--read-attr-by-schema-type"),
+        DELETE("--delete");
+
+        private final String optionName;
+
+        AnyObjectOptions(final String optionName) {
+            this.optionName = optionName;
+        }
+
+        public String getOptionName() {
+            return optionName;
+        }
+
+        public boolean equalsOptionName(final String otherName) {
+            return (otherName == null) ? false : optionName.equals(otherName);
+        }
+
+        public static AnyObjectOptions fromName(final String name) {
+            AnyObjectOptions optionToReturn = HELP;
+            for (final AnyObjectOptions option : AnyObjectOptions.values()) {
+                if (option.equalsOptionName(name)) {
+                    optionToReturn = option;
+                }
+            }
+            return optionToReturn;
+        }
+
+        public static List<String> toList() {
+            final List<String> options = new ArrayList<>();
+            for (final AnyObjectOptions value : values()) {
+                options.add(value.getOptionName());
+            }
+            return options;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/0f938e72/client/cli/src/main/java/org/apache/syncope/client/cli/commands/anyobject/AnyObjectDelete.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/anyobject/AnyObjectDelete.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/anyobject/AnyObjectDelete.java
new file mode 100644
index 0000000..16ff80b
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/anyobject/AnyObjectDelete.java
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.client.cli.commands.anyobject;
+
+import org.apache.syncope.client.cli.Input;
+import org.apache.syncope.common.lib.SyncopeClientException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class AnyObjectDelete extends AbstractAnyObjectCommand {
+
+    private static final Logger LOG = LoggerFactory.getLogger(AnyObjectDelete.class);
+
+    private static final String DELETE_HELP_MESSAGE = "any --delete {ANY-ID} {ANY-ID} [...]";
+
+    private final Input input;
+
+    public AnyObjectDelete(final Input input) {
+        this.input = input;
+    }
+
+    public void delete() {
+        if (input.parameterNumber() >= 1) {
+            for (final String parameter : input.getParameters()) {
+                try {
+                    anySyncopeOperations.delete(parameter);
+                    anyResultManager.deletedMessage("Any", parameter);
+                } catch (final SyncopeClientException ex) {
+                    LOG.error("Error deleting group", ex);
+                    if (ex.getMessage().startsWith("NotFound")) {
+                        anyResultManager.notFoundError("any", parameter);
+                    } else {
+                        anyResultManager.genericError(ex.getMessage());
+                    }
+                } catch (final NumberFormatException ex) {
+                    anyResultManager.numberFormatException("any", parameter);
+                }
+            }
+        } else {
+            anyResultManager.commandOptionError(DELETE_HELP_MESSAGE);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/0f938e72/client/cli/src/main/java/org/apache/syncope/client/cli/commands/anyobject/AnyObjectList.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/anyobject/AnyObjectList.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/anyobject/AnyObjectList.java
new file mode 100644
index 0000000..1e3e658
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/anyobject/AnyObjectList.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.client.cli.commands.anyobject;
+
+import org.apache.syncope.client.cli.Input;
+import org.apache.syncope.common.lib.SyncopeClientException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class AnyObjectList extends AbstractAnyObjectCommand {
+
+    private static final Logger LOG = LoggerFactory.getLogger(AnyObjectList.class);
+
+    private static final String LIST_HELP_MESSAGE = "any --list {ANY-TYPE}";
+
+    private final Input input;
+
+    public AnyObjectList(final Input input) {
+        this.input = input;
+    }
+
+    public void list() {
+        if (input.parameterNumber() == 1) {
+            try {
+                anyResultManager.printAnys(anySyncopeOperations.list(input.firstParameter()));
+            } catch (final SyncopeClientException ex) {
+                LOG.error("Error listing any object", ex);
+                anyResultManager.genericError(ex.getMessage());
+            }
+        } else {
+            anyResultManager.unnecessaryParameters(input.listParameters(), LIST_HELP_MESSAGE);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/0f938e72/client/cli/src/main/java/org/apache/syncope/client/cli/commands/anyobject/AnyObjectRead.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/anyobject/AnyObjectRead.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/anyobject/AnyObjectRead.java
new file mode 100644
index 0000000..03137f7
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/anyobject/AnyObjectRead.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.client.cli.commands.anyobject;
+
+import org.apache.syncope.client.cli.Input;
+import org.apache.syncope.common.lib.SyncopeClientException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class AnyObjectRead extends AbstractAnyObjectCommand {
+
+    private static final Logger LOG = LoggerFactory.getLogger(AnyObjectRead.class);
+
+    private static final String READ_HELP_MESSAGE = "any --read {ANY-ID} {ANY-ID} [...]";
+
+    private final Input input;
+
+    public AnyObjectRead(final Input input) {
+        this.input = input;
+    }
+
+    public void read() {
+        if (input.parameterNumber() >= 1) {
+            for (final String parameter : input.getParameters()) {
+                try {
+                    anyResultManager.printGroup(anySyncopeOperations.read(parameter));
+                } catch (final SyncopeClientException ex) {
+                    LOG.error("Error reading group", ex);
+                    if (ex.getMessage().startsWith("NotFound")) {
+                        anyResultManager.notFoundError("Any object", parameter);
+                    } else {
+                        anyResultManager.genericError(ex.getMessage());
+                    }
+                } catch (final NumberFormatException ex) {
+                    anyResultManager.numberFormatException("any object", parameter);
+                }
+            }
+        } else {
+            anyResultManager.commandOptionError(READ_HELP_MESSAGE);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/0f938e72/client/cli/src/main/java/org/apache/syncope/client/cli/commands/anyobject/AnyObjectReadAttributeBySchemaTypeAndSchemaName.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/anyobject/AnyObjectReadAttributeBySchemaTypeAndSchemaName.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/anyobject/AnyObjectReadAttributeBySchemaTypeAndSchemaName.java
new file mode 100644
index 0000000..8db0e21
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/anyobject/AnyObjectReadAttributeBySchemaTypeAndSchemaName.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.client.cli.commands.anyobject;
+
+import org.apache.syncope.client.cli.Input;
+import org.apache.syncope.client.cli.util.CommandUtils;
+import org.apache.syncope.common.lib.SyncopeClientException;
+import org.apache.syncope.common.lib.types.SchemaType;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class AnyObjectReadAttributeBySchemaTypeAndSchemaName extends AbstractAnyObjectCommand {
+
+    private static final Logger LOG = LoggerFactory.getLogger(AnyObjectReadAttributeBySchemaTypeAndSchemaName.class);
+
+    private static final String READ_HELP_MESSAGE
+            = "any --read-attr-by-schema {ANY-ID} {SCHEMA-TYPE} {SCHEMA-NAME}\n"
+            + "   Schema type: PLAIN / DERIVED / VIRTUAL";
+
+    private final Input input;
+
+    public AnyObjectReadAttributeBySchemaTypeAndSchemaName(final Input input) {
+        this.input = input;
+    }
+
+    public void read() {
+        if (input.parameterNumber() == 3) {
+            try {
+                anyResultManager.printAttribute(anySyncopeOperations.readAttribute(
+                        input.firstParameter(), input.secondParameter(), input.thirdParameter()));
+            } catch (final SyncopeClientException ex) {
+                LOG.error("Error reading any object", ex);
+                anyResultManager.genericError(ex.getMessage());
+            } catch (final NumberFormatException ex) {
+                anyResultManager.numberFormatException("any object", input.firstParameter());
+            } catch (final IllegalArgumentException ex) {
+                LOG.error("Error reading schema", ex);
+                anyResultManager.typeNotValidError(
+                        "schema", input.secondParameter(), CommandUtils.fromEnumToArray(SchemaType.class));
+            }
+        } else {
+            anyResultManager.commandOptionError(READ_HELP_MESSAGE);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/0f938e72/client/cli/src/main/java/org/apache/syncope/client/cli/commands/anyobject/AnyObjectReadAttributesBySchemaType.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/anyobject/AnyObjectReadAttributesBySchemaType.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/anyobject/AnyObjectReadAttributesBySchemaType.java
new file mode 100644
index 0000000..ff42b0a
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/anyobject/AnyObjectReadAttributesBySchemaType.java
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.client.cli.commands.anyobject;
+
+import org.apache.syncope.client.cli.Input;
+import org.apache.syncope.client.cli.util.CommandUtils;
+import org.apache.syncope.common.lib.SyncopeClientException;
+import org.apache.syncope.common.lib.types.SchemaType;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class AnyObjectReadAttributesBySchemaType extends AbstractAnyObjectCommand {
+
+    private static final Logger LOG = LoggerFactory.getLogger(AnyObjectReadAttributesBySchemaType.class);
+
+    private static final String READ_HELP_MESSAGE = "any --read-attr-by-schema-type {ANY-ID} {SCHEMA-TYPE}\n"
+            + "   Schema type: PLAIN / DERIVED / VIRTUAL";
+
+    private final Input input;
+
+    public AnyObjectReadAttributesBySchemaType(final Input input) {
+        this.input = input;
+    }
+
+    public void read() {
+        if (input.parameterNumber() == 2) {
+            try {
+                anyResultManager.printAttributes(anySyncopeOperations.readAttributes(
+                        input.firstParameter(), input.secondParameter()));
+            } catch (final SyncopeClientException ex) {
+                LOG.error("Error reading any", ex);
+                if (ex.getMessage().startsWith("NotFound")) {
+                    anyResultManager.notFoundError("Any", input.firstParameter());
+                } else {
+                    anyResultManager.genericError(ex.getMessage());
+                }
+            } catch (final NumberFormatException ex) {
+                anyResultManager.numberFormatException("any", input.firstParameter());
+            } catch (final IllegalArgumentException ex) {
+                LOG.error("Error reading schema", ex);
+                anyResultManager.typeNotValidError(
+                        "schema", input.secondParameter(), CommandUtils.fromEnumToArray(SchemaType.class));
+            }
+        } else {
+            anyResultManager.commandOptionError(READ_HELP_MESSAGE);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/0f938e72/client/cli/src/main/java/org/apache/syncope/client/cli/commands/anyobject/AnyObjectResultManager.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/anyobject/AnyObjectResultManager.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/anyobject/AnyObjectResultManager.java
new file mode 100644
index 0000000..4f89b23
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/anyobject/AnyObjectResultManager.java
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.client.cli.commands.anyobject;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import org.apache.syncope.client.cli.commands.CommonsResultManager;
+import org.apache.syncope.common.lib.to.AnyObjectTO;
+import org.apache.syncope.common.lib.to.AttrTO;
+
+public class AnyObjectResultManager extends CommonsResultManager {
+
+    public void printAnys(final List<AnyObjectTO> anyObjectTOs) {
+        System.out.println("");
+        for (final AnyObjectTO anyObjectTO : anyObjectTOs) {
+            printGroup(anyObjectTO);
+        }
+    }
+
+    public void printGroup(final AnyObjectTO anyObjectTO) {
+        System.out.println(" > ANY ID: " + anyObjectTO.getKey());
+        System.out.println("    type: " + anyObjectTO.getType());
+        System.out.println("    realm: " + anyObjectTO.getRealm());
+        System.out.println("    status: " + anyObjectTO.getStatus());
+        System.out.println("    RESOURCES: ");
+        printResources(anyObjectTO.getResources());
+        System.out.println("    PLAIN ATTRIBUTES: ");
+        printAttributes(anyObjectTO.getPlainAttrs());
+        System.out.println("    DERIVED ATTRIBUTES: ");
+        printAttributes(anyObjectTO.getDerAttrs());
+        System.out.println("    VIRTUAL ATTRIBUTES: ");
+        printAttributes(anyObjectTO.getVirAttrs());
+    }
+
+    private void printResources(final Set<String> resources) {
+        for (final String resource : resources) {
+            System.out.println("      - " + resource);
+        }
+    }
+
+    public void printAttributes(final Set<AttrTO> attributes) {
+        for (final AttrTO attribute : attributes) {
+            printAttribute(attribute);
+        }
+        System.out.println("");
+    }
+
+    public void printAttribute(final AttrTO attribute) {
+        final StringBuilder attributeMessageBuilder = new StringBuilder();
+        attributeMessageBuilder.append("     - ")
+                .append(attribute.getSchema())
+                .append(": ")
+                .append(attribute.getValues());
+        if (attribute.isReadonly()) {
+            attributeMessageBuilder.append(" - is readonly");
+        }
+        System.out.println(attributeMessageBuilder.toString());
+    }
+
+    public void printDetails(final Map<String, String> details) {
+        printDetails("groups details", details);
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/0f938e72/client/cli/src/main/java/org/apache/syncope/client/cli/commands/anyobject/AnyObjectSyncopeOperations.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/anyobject/AnyObjectSyncopeOperations.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/anyobject/AnyObjectSyncopeOperations.java
new file mode 100644
index 0000000..c55499a
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/anyobject/AnyObjectSyncopeOperations.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.client.cli.commands.anyobject;
+
+import java.util.List;
+import java.util.Set;
+import org.apache.syncope.client.cli.SyncopeServices;
+import org.apache.syncope.common.lib.to.AnyObjectTO;
+import org.apache.syncope.common.lib.to.AttrTO;
+import org.apache.syncope.common.lib.types.SchemaType;
+import org.apache.syncope.common.rest.api.beans.AnyListQuery;
+import org.apache.syncope.common.rest.api.service.AnyObjectService;
+
+public class AnyObjectSyncopeOperations {
+
+    private final AnyObjectService anyObjectService = SyncopeServices.get(AnyObjectService.class);
+
+    public List<AnyObjectTO> list(final String type) {
+        return anyObjectService.list(type, new AnyListQuery()).getResult();
+    }
+
+    public AnyObjectTO read(final String anyId) {
+        return anyObjectService.read(Long.valueOf(anyId));
+    }
+
+    public Set<AttrTO> readAttributes(final String anyId, final String schemaType) {
+        return anyObjectService.read(Long.valueOf(anyId), SchemaType.valueOf(schemaType));
+    }
+
+    public AttrTO readAttribute(final String anyId, final String schemaType, final String schema) {
+        return anyObjectService.read(Long.valueOf(anyId), SchemaType.valueOf(schemaType), schema);
+    }
+
+    public void delete(final String anyId) {
+        anyObjectService.delete(Long.valueOf(anyId));
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/0f938e72/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyService.java
index ec8495c..1d1bb0f 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyService.java
@@ -41,7 +41,6 @@ import org.apache.syncope.common.lib.to.BulkAction;
 import org.apache.syncope.common.lib.to.BulkActionResult;
 import org.apache.syncope.common.lib.to.PagedResult;
 import org.apache.syncope.common.lib.types.SchemaType;
-import org.apache.syncope.common.rest.api.beans.AnyListQuery;
 import org.apache.syncope.common.rest.api.beans.AnySearchQuery;
 
 public interface AnyService<TO extends AnyTO, P extends AnyPatch> extends JAXRSService {
@@ -86,16 +85,6 @@ public interface AnyService<TO extends AnyTO, P extends AnyPatch> extends JAXRSS
     TO read(@NotNull @PathParam("key") Long key);
 
     /**
-     * Returns a paged list of existing any objects matching the given query.
-     *
-     * @param listQuery query conditions
-     * @return paged list of existing any objects matching the given query
-     */
-    @GET
-    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
-    PagedResult<TO> list(@BeanParam AnyListQuery listQuery);
-
-    /**
      * Returns a paged list of any objects matching the given query.
      *
      * @param searchQuery query conditions

http://git-wip-us.apache.org/repos/asf/syncope/blob/0f938e72/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/GroupService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/GroupService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/GroupService.java
index d1e556d..08535dc 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/GroupService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/GroupService.java
@@ -19,12 +19,15 @@
 package org.apache.syncope.common.rest.api.service;
 
 import java.util.List;
+import javax.ws.rs.BeanParam;
 import javax.ws.rs.GET;
 import javax.ws.rs.Path;
 import javax.ws.rs.Produces;
 import javax.ws.rs.core.MediaType;
 import org.apache.syncope.common.lib.patch.GroupPatch;
 import org.apache.syncope.common.lib.to.GroupTO;
+import org.apache.syncope.common.lib.to.PagedResult;
+import org.apache.syncope.common.rest.api.beans.AnyListQuery;
 
 /**
  * REST operations for groups.
@@ -42,4 +45,14 @@ public interface GroupService extends AnyService<GroupTO, GroupPatch> {
     @Path("own")
     @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
     List<GroupTO> own();
+
+    /**
+     * Returns a paged list of existing groups matching the given query.
+     *
+     * @param listQuery query conditions
+     * @return paged list of existing groups matching the given query
+     */
+    @GET
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    PagedResult<GroupTO> list(@BeanParam AnyListQuery listQuery);
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/0f938e72/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserService.java
index e23e6cd..1fc14f9 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserService.java
@@ -19,8 +19,10 @@
 package org.apache.syncope.common.rest.api.service;
 
 import javax.validation.constraints.NotNull;
+import javax.ws.rs.BeanParam;
 import javax.ws.rs.Consumes;
 import javax.ws.rs.DefaultValue;
+import javax.ws.rs.GET;
 import javax.ws.rs.OPTIONS;
 import javax.ws.rs.POST;
 import javax.ws.rs.Path;
@@ -31,7 +33,9 @@ import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 import org.apache.syncope.common.lib.patch.StatusPatch;
 import org.apache.syncope.common.lib.patch.UserPatch;
+import org.apache.syncope.common.lib.to.PagedResult;
 import org.apache.syncope.common.lib.to.UserTO;
+import org.apache.syncope.common.rest.api.beans.AnyListQuery;
 
 /**
  * REST operations for users.
@@ -60,6 +64,16 @@ public interface UserService extends AnyService<UserTO, UserPatch> {
     Response getUserKey(@NotNull @PathParam("username") String username);
 
     /**
+     * Returns a paged list of existing users matching the given query.
+     *
+     * @param listQuery query conditions
+     * @return paged list of existing users matching the given query
+     */
+    @GET
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    PagedResult<UserTO> list(@BeanParam AnyListQuery listQuery);
+
+    /**
      * Creates a new user.
      *
      * @param userTO user to be created

http://git-wip-us.apache.org/repos/asf/syncope/blob/0f938e72/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/AbstractAnyService.java
----------------------------------------------------------------------
diff --git a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/AbstractAnyService.java b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/AbstractAnyService.java
index 07dba6e..e08c476 100644
--- a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/AbstractAnyService.java
+++ b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/AbstractAnyService.java
@@ -109,8 +109,7 @@ public abstract class AbstractAnyService<TO extends AnyTO, P extends AnyPatch>
         return getAnyLogic().read(key);
     }
 
-    @Override
-    public PagedResult<TO> list(final AnyListQuery listQuery) {
+    protected PagedResult<TO> list(final AnyListQuery listQuery) {
         CollectionUtils.transform(listQuery.getRealms(), new Transformer<String, String>() {
 
             @Override
@@ -260,8 +259,8 @@ public abstract class AbstractAnyService<TO extends AnyTO, P extends AnyPatch>
             for (String resource : patch.getResources()) {
                 result.getResults().put(resource,
                         updated.getAny().getResources().contains(resource)
-                                ? BulkActionResult.Status.FAILURE
-                                : BulkActionResult.Status.SUCCESS);
+                        ? BulkActionResult.Status.FAILURE
+                        : BulkActionResult.Status.SUCCESS);
             }
         } else {
             for (PropagationStatus propagationStatusTO : updated.getPropagationStatuses()) {
@@ -317,8 +316,8 @@ public abstract class AbstractAnyService<TO extends AnyTO, P extends AnyPatch>
             for (String resource : patch.getResources()) {
                 result.getResults().put(resource,
                         updated.getAny().getResources().contains(resource)
-                                ? BulkActionResult.Status.FAILURE
-                                : BulkActionResult.Status.SUCCESS);
+                        ? BulkActionResult.Status.FAILURE
+                        : BulkActionResult.Status.SUCCESS);
             }
         } else {
             for (PropagationStatus propagationStatusTO : updated.getPropagationStatuses()) {

http://git-wip-us.apache.org/repos/asf/syncope/blob/0f938e72/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/GroupServiceImpl.java
----------------------------------------------------------------------
diff --git a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/GroupServiceImpl.java b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/GroupServiceImpl.java
index f2915f7..cf65346 100644
--- a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/GroupServiceImpl.java
+++ b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/GroupServiceImpl.java
@@ -21,6 +21,8 @@ package org.apache.syncope.core.rest.cxf.service;
 import java.util.List;
 import org.apache.syncope.common.lib.patch.GroupPatch;
 import org.apache.syncope.common.lib.to.GroupTO;
+import org.apache.syncope.common.lib.to.PagedResult;
+import org.apache.syncope.common.rest.api.beans.AnyListQuery;
 import org.apache.syncope.common.rest.api.service.GroupService;
 import org.apache.syncope.core.logic.AbstractAnyLogic;
 import org.apache.syncope.core.logic.GroupLogic;
@@ -50,4 +52,9 @@ public class GroupServiceImpl extends AbstractAnyService<GroupTO, GroupPatch> im
         return logic.own();
     }
 
+    @Override
+    public PagedResult<GroupTO> list(final AnyListQuery listQuery) {
+        return super.list(listQuery);
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/0f938e72/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/UserServiceImpl.java
----------------------------------------------------------------------
diff --git a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/UserServiceImpl.java b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/UserServiceImpl.java
index 0f62925..1b57c38 100644
--- a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/UserServiceImpl.java
+++ b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/UserServiceImpl.java
@@ -22,9 +22,11 @@ import javax.ws.rs.core.HttpHeaders;
 import javax.ws.rs.core.Response;
 import org.apache.syncope.common.lib.patch.StatusPatch;
 import org.apache.syncope.common.lib.patch.UserPatch;
+import org.apache.syncope.common.lib.to.PagedResult;
 import org.apache.syncope.common.lib.to.ProvisioningResult;
 import org.apache.syncope.common.lib.to.UserTO;
 import org.apache.syncope.common.rest.api.RESTHeaders;
+import org.apache.syncope.common.rest.api.beans.AnyListQuery;
 import org.apache.syncope.common.rest.api.service.UserService;
 import org.apache.syncope.core.logic.AbstractAnyLogic;
 import org.apache.syncope.core.logic.UserLogic;
@@ -64,6 +66,11 @@ public class UserServiceImpl extends AbstractAnyService<UserTO, UserPatch> imple
     }
 
     @Override
+    public PagedResult<UserTO> list(final AnyListQuery listQuery) {
+        return super.list(listQuery);
+    }
+
+    @Override
     public Response create(final UserTO userTO, final boolean storePassword) {
         ProvisioningResult<UserTO> created = logic.create(userTO, storePassword, isNullPriorityAsync());
         return createResponse(created);