You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by ma...@apache.org on 2015/10/27 18:07:49 UTC

[1/2] syncope git commit: Fixed SYNCOPE-580, refactoring and added realm stack, SYNCOPE-158

Repository: syncope
Updated Branches:
  refs/heads/master 7866cdba5 -> 47b9f64bd


http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportList.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportList.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportList.java
index 1d3e5de..7fca5c0 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportList.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportList.java
@@ -24,7 +24,7 @@ public class ReportList extends AbstractReportCommand {
 
     public void list() {
         try {
-            reportResultManager.fromValueToView(reportService.list());
+            reportResultManager.fromValueToView(reportSyncopeOperations.list());
         } catch (final SyncopeClientException ex) {
             reportResultManager.generic(ex.getMessage());
         }

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportListJobs.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportListJobs.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportListJobs.java
index 9bc688e..5b13cbf 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportListJobs.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportListJobs.java
@@ -26,7 +26,7 @@ public class ReportListJobs extends AbstractReportCommand {
     public void list() {
         try {
             for (final JobStatusType jobStatusType : JobStatusType.values()) {
-                reportResultManager.printReportExecution(reportService.listJobs(jobStatusType));
+                reportResultManager.printReportExecution(reportSyncopeOperations.listJobs(jobStatusType));
             }
         } catch (final SyncopeClientException ex) {
             reportResultManager.generic(ex.getMessage());

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportRead.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportRead.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportRead.java
index d1ab975..9a1ebc8 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportRead.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportRead.java
@@ -40,9 +40,9 @@ public class ReportRead extends AbstractReportCommand {
             final List<ReportTO> reportTOs = new ArrayList<>();
             for (final String parameter : input.getParameters()) {
                 try {
-                    reportTOs.add(reportService.read(Long.valueOf(parameter)));
+                    reportTOs.add(reportSyncopeOperations.read(parameter));
                 } catch (final NumberFormatException ex) {
-                    reportResultManager.managerNumberFormatException("report", parameter);
+                    reportResultManager.numberFormatException("report", parameter);
                 } catch (final WebServiceException | SyncopeClientException ex) {
                     if (ex.getMessage().startsWith("NotFound")) {
                         reportResultManager.notFoundError("Report", parameter);

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportReadExecution.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportReadExecution.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportReadExecution.java
index 95c61cd..45d1c54 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportReadExecution.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportReadExecution.java
@@ -41,7 +41,7 @@ public class ReportReadExecution extends AbstractReportCommand {
             final List<ReportExecTO> reportExecTOs = new ArrayList<>();
             for (final String parameter : input.getParameters()) {
                 try {
-                    reportExecTOs.add(reportService.readExecution(Long.valueOf(parameter)));
+                    reportExecTOs.add(reportSyncopeOperations.readExecution(parameter));
                 } catch (final WebServiceException | SyncopeClientException ex) {
                     System.out.println("Error:");
                     if (ex.getMessage().startsWith("NotFound")) {
@@ -50,7 +50,7 @@ public class ReportReadExecution extends AbstractReportCommand {
                         reportResultManager.generic(ex.getMessage());
                     }
                 } catch (final NumberFormatException ex) {
-                    reportResultManager.managerNumberFormatException("report", parameter);
+                    reportResultManager.numberFormatException("report", parameter);
                 }
             }
             reportResultManager.printReportExecution(reportExecTOs);

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportSyncopeOperations.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportSyncopeOperations.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportSyncopeOperations.java
new file mode 100644
index 0000000..1cf4514
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportSyncopeOperations.java
@@ -0,0 +1,65 @@
+/*
+ * 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.report;
+
+import java.util.List;
+import javax.ws.rs.core.Response;
+import org.apache.syncope.client.cli.SyncopeServices;
+import org.apache.syncope.common.lib.to.ReportExecTO;
+import org.apache.syncope.common.lib.to.ReportTO;
+import org.apache.syncope.common.lib.types.JobStatusType;
+import org.apache.syncope.common.lib.types.ReportExecExportFormat;
+import org.apache.syncope.common.rest.api.service.ReportService;
+
+public class ReportSyncopeOperations {
+
+    private final ReportService reportService = SyncopeServices.get(ReportService.class);
+
+    public ReportExecTO readExecution(final String executionid) {
+        return reportService.readExecution(Long.valueOf(executionid));
+    }
+
+    public ReportTO read(final String reportId) {
+        return reportService.read(Long.valueOf(reportId));
+    }
+
+    public List<ReportExecTO> listJobs(final JobStatusType jobStatusType) {
+        return reportService.listJobs(jobStatusType);
+    }
+
+    public List<ReportTO> list() {
+        return reportService.list();
+    }
+
+    public Response exportExecutionResult(final String executionKey, final ReportExecExportFormat fmt) {
+        return reportService.exportExecutionResult(Long.valueOf(executionKey), fmt);
+    }
+
+    public void execute(final String reportId) {
+        reportService.execute(Long.valueOf(reportId));
+    }
+
+    public void deleteExecution(final String executionId) {
+        reportService.deleteExecution(Long.valueOf(executionId));
+    }
+
+    public void delete(final String reportId) {
+        reportService.delete(Long.valueOf(reportId));
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/AbstractResourceCommand.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/AbstractResourceCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/AbstractResourceCommand.java
index 85d4a2d..943f405 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/AbstractResourceCommand.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/AbstractResourceCommand.java
@@ -18,13 +18,10 @@
  */
 package org.apache.syncope.client.cli.commands.resource;
 
-import org.apache.syncope.client.cli.SyncopeServices;
-import org.apache.syncope.common.rest.api.service.ResourceService;
-
 public abstract class AbstractResourceCommand {
 
-    protected final ResourceService resourceService = SyncopeServices.get(ResourceService.class);
-
+    protected final ResourceSyncopeOperations resourceSyncopeOperations = new ResourceSyncopeOperations();
+    
     protected final ResourceResultManager resourceResultManager = new ResourceResultManager();
 
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceDelete.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceDelete.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceDelete.java
index c3ecd84..9068b7d 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceDelete.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceDelete.java
@@ -35,10 +35,10 @@ public class ResourceDelete extends AbstractResourceCommand {
         if (input.getParameters().length >= 1) {
             for (final String parameter : input.getParameters()) {
                 try {
-                    resourceService.delete(parameter);
+                    resourceSyncopeOperations.delete(parameter);
                     resourceResultManager.deletedMessage("resource", parameter);
                 } catch (final NumberFormatException ex) {
-                    resourceResultManager.managerNumberFormatException("resource", parameter);
+                    resourceResultManager.numberFormatException("resource", parameter);
                 } catch (final SyncopeClientException | WebServiceException ex) {
                     if (ex.getMessage().startsWith("NotFound")) {
                         resourceResultManager.notFoundError("Resource", parameter);

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceList.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceList.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceList.java
index 85f05f5..27f0d74 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceList.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceList.java
@@ -24,7 +24,7 @@ public class ResourceList extends AbstractResourceCommand {
 
     public void list() {
         try {
-            resourceResultManager.toView(resourceService.list());
+            resourceResultManager.toView(resourceSyncopeOperations.list());
         } catch (final SyncopeClientException ex) {
             resourceResultManager.generic(ex.getMessage());
         }

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceRead.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceRead.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceRead.java
index 3790c02..85cd669 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceRead.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceRead.java
@@ -39,9 +39,9 @@ public class ResourceRead extends AbstractResourceCommand {
             final List<ResourceTO> resourceTOs = new ArrayList<>();
             for (final String parameter : input.getParameters()) {
                 try {
-                    resourceTOs.add(resourceService.read(parameter));
+                    resourceTOs.add(resourceSyncopeOperations.read(parameter));
                 } catch (final NumberFormatException ex) {
-                    resourceResultManager.managerNumberFormatException("resource", parameter);
+                    resourceResultManager.numberFormatException("resource", parameter);
                 } catch (final SyncopeClientException | WebServiceException ex) {
                     if (ex.getMessage().startsWith("NotFound")) {
                         resourceResultManager.notFoundError("Resource", parameter);

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceResultManager.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceResultManager.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceResultManager.java
index 91847f4..d598910 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceResultManager.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceResultManager.java
@@ -54,6 +54,7 @@ public class ResourceResultManager extends CommonsResultManager {
         System.out.println("    delete trace level: " + resourceTO.getDeleteTraceLevel());
         System.out.println("    update trace level: " + resourceTO.getUpdateTraceLevel());
         System.out.println("    sync trace level: " + resourceTO.getSyncTraceLevel());
+        System.out.println("");
     }
 
     private void printProvision(final List<ProvisionTO> provisionTOs) {
@@ -66,14 +67,12 @@ public class ResourceResultManager extends CommonsResultManager {
             System.out.println("       MAPPING: ");
             printMapping(provisionTO.getMapping());
         }
-        System.out.println("");
     }
 
     private void printMapping(final MappingTO mappingTO) {
         System.out.println("          ConnObjectLink: " + mappingTO.getConnObjectLink());
         System.out.println("          MAPPING ITEM: ");
         printMappingItem(mappingTO.getItems());
-        System.out.println("");
     }
 
     private void printMappingItem(final List<MappingItemTO> mappingItemTOs) {
@@ -88,8 +87,8 @@ public class ResourceResultManager extends CommonsResultManager {
             System.out.println("             purpose: " + mappingItemTO.getPurpose());
             System.out.println("             connector object key: " + mappingItemTO.isConnObjectKey());
             System.out.println("             password: " + mappingItemTO.isPassword());
+            System.out.println("");
         }
-        System.out.println("");
     }
 
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceSyncopeOperations.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceSyncopeOperations.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceSyncopeOperations.java
new file mode 100644
index 0000000..9ddedf8
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceSyncopeOperations.java
@@ -0,0 +1,51 @@
+/*
+ * 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.resource;
+
+import java.util.List;
+import org.apache.syncope.client.cli.SyncopeServices;
+import org.apache.syncope.common.lib.SyncopeClientException;
+import org.apache.syncope.common.lib.to.ResourceTO;
+import org.apache.syncope.common.rest.api.service.ResourceService;
+
+public class ResourceSyncopeOperations {
+
+    private final ResourceService resourceService = SyncopeServices.get(ResourceService.class);
+
+    public void delete(final String name) {
+        resourceService.delete(name);
+    }
+
+    public List<ResourceTO> list() {
+        return resourceService.list();
+    }
+
+    public ResourceTO read(final String name) {
+        return resourceService.read(name);
+    }
+
+    public boolean exists(final String name) {
+        try {
+            read(name);
+            return true;
+        } catch (final SyncopeClientException ex) {
+            return false;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/AbstractSchemaCommand.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/AbstractSchemaCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/AbstractSchemaCommand.java
index 3074135..96dae04 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/AbstractSchemaCommand.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/AbstractSchemaCommand.java
@@ -18,13 +18,10 @@
  */
 package org.apache.syncope.client.cli.commands.schema;
 
-import org.apache.syncope.client.cli.SyncopeServices;
-import org.apache.syncope.common.rest.api.service.SchemaService;
-
 public abstract class AbstractSchemaCommand {
 
-    protected final SchemaService schemaService = SyncopeServices.get(SchemaService.class);
-    
+    protected final SchemaSyncopeOperations schemaSyncopeOperations = new SchemaSyncopeOperations();
+
     protected final SchemaResultManager schemaResultManager = new SchemaResultManager();
 
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaDelete.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaDelete.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaDelete.java
index 9cf6fe2..0850e2f 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaDelete.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaDelete.java
@@ -41,7 +41,7 @@ public class SchemaDelete extends AbstractSchemaCommand {
             final String[] parameters = Arrays.copyOfRange(input.getParameters(), 1, input.parameterNumber());
             try {
                 for (final String parameter : parameters) {
-                    schemaService.delete(SchemaType.valueOf(input.firstParameter()), parameter);
+                    schemaSyncopeOperations.delete(SchemaType.valueOf(input.firstParameter()), parameter);
                     schemaResultManager.deletedMessage("Schema", parameter);
                 }
             } catch (final SyncopeClientException | WebServiceException ex) {

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaList.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaList.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaList.java
index 5f51604..404a487 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaList.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaList.java
@@ -41,7 +41,7 @@ public class SchemaList extends AbstractSchemaCommand {
             try {
                 final SchemaType schemaType = SchemaType.valueOf(input.firstParameter());
                 final LinkedList<AbstractSchemaTO> schemaTOs = new LinkedList<>();
-                for (final AbstractSchemaTO schemaTO : schemaService.list(schemaType)) {
+                for (final AbstractSchemaTO schemaTO : schemaSyncopeOperations.list(schemaType)) {
                     schemaTOs.add(schemaTO);
                 }
                 switch (schemaType) {

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaListAll.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaListAll.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaListAll.java
index 5d00adb..57d95a1 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaListAll.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaListAll.java
@@ -30,7 +30,7 @@ public class SchemaListAll extends AbstractSchemaCommand {
         try {
             for (final SchemaType schemaType : SchemaType.values()) {
                 final LinkedList<AbstractSchemaTO> schemaTOs = new LinkedList<>();
-                for (final AbstractSchemaTO schemaTO : schemaService.list(schemaType)) {
+                for (final AbstractSchemaTO schemaTO : schemaSyncopeOperations.list(schemaType)) {
                     schemaTOs.add(schemaTO);
                 }
                 switch (schemaType) {

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaListDerived.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaListDerived.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaListDerived.java
index 8cdb501..ee90327 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaListDerived.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaListDerived.java
@@ -22,14 +22,13 @@ import java.util.LinkedList;
 import javax.xml.ws.WebServiceException;
 import org.apache.syncope.common.lib.SyncopeClientException;
 import org.apache.syncope.common.lib.to.AbstractSchemaTO;
-import org.apache.syncope.common.lib.types.SchemaType;
 
 public class SchemaListDerived extends AbstractSchemaCommand {
 
     public void listDerived() {
         try {
             final LinkedList<AbstractSchemaTO> schemaTOs = new LinkedList<>();
-            for (final AbstractSchemaTO schemaTO : schemaService.list(SchemaType.DERIVED)) {
+            for (final AbstractSchemaTO schemaTO : schemaSyncopeOperations.listDerived()) {
                 schemaTOs.add(schemaTO);
             }
             schemaResultManager.fromListDerived(schemaTOs);

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaListPlain.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaListPlain.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaListPlain.java
index e4160a7..6fa9ad6 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaListPlain.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaListPlain.java
@@ -22,14 +22,13 @@ import java.util.LinkedList;
 import javax.xml.ws.WebServiceException;
 import org.apache.syncope.common.lib.SyncopeClientException;
 import org.apache.syncope.common.lib.to.AbstractSchemaTO;
-import org.apache.syncope.common.lib.types.SchemaType;
 
 public class SchemaListPlain extends AbstractSchemaCommand {
 
     public void listPlain() {
         try {
             final LinkedList<AbstractSchemaTO> schemaTOs = new LinkedList<>();
-            for (final AbstractSchemaTO schemaTO : schemaService.list(SchemaType.PLAIN)) {
+            for (final AbstractSchemaTO schemaTO : schemaSyncopeOperations.listPlain()) {
                 schemaTOs.add(schemaTO);
             }
             schemaResultManager.fromListPlain(schemaTOs);

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaListVirtual.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaListVirtual.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaListVirtual.java
index 7b1bf24..74b5b6c 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaListVirtual.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaListVirtual.java
@@ -22,14 +22,13 @@ import java.util.LinkedList;
 import javax.xml.ws.WebServiceException;
 import org.apache.syncope.common.lib.SyncopeClientException;
 import org.apache.syncope.common.lib.to.AbstractSchemaTO;
-import org.apache.syncope.common.lib.types.SchemaType;
 
 public class SchemaListVirtual extends AbstractSchemaCommand {
 
     public void listVirtual() {
         try {
             final LinkedList<AbstractSchemaTO> schemaTOs = new LinkedList<>();
-            for (final AbstractSchemaTO schemaTO : schemaService.list(SchemaType.VIRTUAL)) {
+            for (final AbstractSchemaTO schemaTO : schemaSyncopeOperations.listVirtual()) {
                 schemaTOs.add(schemaTO);
             }
             schemaResultManager.fromListVirtual(schemaTOs);

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaRead.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaRead.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaRead.java
index 97f1029..d84444d 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaRead.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaRead.java
@@ -45,7 +45,7 @@ public class SchemaRead extends AbstractSchemaCommand {
                 final SchemaType schemaType = SchemaType.valueOf(input.firstParameter());
                 final LinkedList<AbstractSchemaTO> schemaTOs = new LinkedList<>();
                 for (final String parameter : parameters) {
-                    schemaTOs.add(schemaService.read(schemaType, parameter));
+                    schemaTOs.add(schemaSyncopeOperations.read(schemaType, parameter));
                 }
                 switch (schemaType) {
                     case PLAIN:

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaSyncopeOperations.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaSyncopeOperations.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaSyncopeOperations.java
new file mode 100644
index 0000000..c8f0a6d
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaSyncopeOperations.java
@@ -0,0 +1,54 @@
+/*
+ * 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.schema;
+
+import java.util.List;
+import org.apache.syncope.client.cli.SyncopeServices;
+import org.apache.syncope.common.lib.to.AbstractSchemaTO;
+import org.apache.syncope.common.lib.types.SchemaType;
+import org.apache.syncope.common.rest.api.service.SchemaService;
+
+public class SchemaSyncopeOperations {
+
+    private final SchemaService schemaService = SyncopeServices.get(SchemaService.class);
+
+    public <T extends AbstractSchemaTO> T read(final SchemaType schemaType, final String schemaName) {
+        return schemaService.read(schemaType, schemaName);
+    }
+
+    public <T extends AbstractSchemaTO> List<T> list(final SchemaType schemaType) {
+        return schemaService.list(schemaType);
+    }
+
+    public <T extends AbstractSchemaTO> List<T> listVirtual() {
+        return schemaService.list(SchemaType.VIRTUAL);
+    }
+
+    public <T extends AbstractSchemaTO> List<T> listPlain() {
+        return schemaService.list(SchemaType.PLAIN);
+    }
+
+    public <T extends AbstractSchemaTO> List<T> listDerived() {
+        return schemaService.list(SchemaType.DERIVED);
+    }
+
+    public void delete(final SchemaType schemaType, final String schemaName) {
+        schemaService.delete(schemaType, schemaName);
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/AbstractTaskCommand.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/AbstractTaskCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/AbstractTaskCommand.java
index 18e877a..bdc4c22 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/AbstractTaskCommand.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/AbstractTaskCommand.java
@@ -18,12 +18,9 @@
  */
 package org.apache.syncope.client.cli.commands.task;
 
-import org.apache.syncope.client.cli.SyncopeServices;
-import org.apache.syncope.common.rest.api.service.TaskService;
-
 public abstract class AbstractTaskCommand {
 
-    protected final TaskService taskService = SyncopeServices.get(TaskService.class);
+    protected final TaskSyncopeOperations taskSyncopeOperations = new TaskSyncopeOperations();
 
     protected final TaskResultManager taskResultManager = new TaskResultManager();
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskDelete.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskDelete.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskDelete.java
index 655e112..e0d4753 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskDelete.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskDelete.java
@@ -37,7 +37,7 @@ public class TaskDelete extends AbstractTaskCommand {
         if (input.parameterNumber() >= 1) {
             for (final String parameter : input.getParameters()) {
                 try {
-                    taskService.delete(Long.valueOf(parameter));
+                    taskSyncopeOperations.delete(parameter);
                     taskResultManager.deletedMessage("Task", parameter);
                 } catch (final WebServiceException | SyncopeClientException ex) {
                     if (ex.getMessage().startsWith("NotFound")) {

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskExecute.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskExecute.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskExecute.java
index 9f53ece..dfefae3 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskExecute.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskExecute.java
@@ -37,7 +37,6 @@ public class TaskExecute extends AbstractTaskCommand {
     public void execute() {
         if (input.parameterNumber() == 2) {
             try {
-                final Long taskIdToExecute = Long.valueOf(input.firstParameter());
                 boolean dryRun = true;
                 if ("false".equalsIgnoreCase(input.secondParameter())) {
                     dryRun = false;
@@ -46,7 +45,8 @@ public class TaskExecute extends AbstractTaskCommand {
                 } else {
                     taskResultManager.notBooleanDeletedError("dry run", input.secondParameter());
                 }
-                taskResultManager.printTaskExecTO(Arrays.asList(taskService.execute(taskIdToExecute, dryRun)));
+                taskResultManager.printTaskExecTO(Arrays.asList(
+                        taskSyncopeOperations.execute(input.firstParameter(), dryRun)));
             } catch (final WebServiceException | SyncopeClientException ex) {
                 if (ex.getMessage().startsWith("NotFound")) {
                     taskResultManager.notFoundError("Task", input.firstParameter());

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskExecutionDelete.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskExecutionDelete.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskExecutionDelete.java
index a107716..bb6d694 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskExecutionDelete.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskExecutionDelete.java
@@ -37,7 +37,7 @@ public class TaskExecutionDelete extends AbstractTaskCommand {
         if (input.parameterNumber() >= 1) {
             for (final String parameter : input.getParameters()) {
                 try {
-                    taskService.deleteExecution(Long.valueOf(parameter));
+                    taskSyncopeOperations.deleteExecution(parameter);
                     taskResultManager.deletedMessage("Task execution", parameter);
                 } catch (final WebServiceException | SyncopeClientException ex) {
                     if (ex.getMessage().startsWith("NotFound")) {

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskExecutionRead.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskExecutionRead.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskExecutionRead.java
index d24641d..d83e2ef 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskExecutionRead.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskExecutionRead.java
@@ -38,7 +38,7 @@ public class TaskExecutionRead extends AbstractTaskCommand {
             for (final String parameter : input.getParameters()) {
                 try {
                     taskResultManager.printTaskExecTO(
-                            Arrays.asList(taskService.readExecution(Long.valueOf(parameter))));
+                            Arrays.asList(taskSyncopeOperations.readExecution(parameter)));
                 } catch (final NumberFormatException ex) {
                     taskResultManager.notBooleanDeletedError("task execution", parameter);
                 } catch (final SyncopeClientException | WebServiceException ex) {

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskList.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskList.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskList.java
index 203dbcb..b8c08e5 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskList.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskList.java
@@ -42,7 +42,7 @@ public class TaskList extends AbstractTaskCommand {
             try {
                 final TaskType taskType = TaskType.valueOf(input.firstParameter());
                 final LinkedList<AbstractTaskTO> taskTOs = new LinkedList<>();
-                for (final AbstractTaskTO taskTO : taskService.list(taskType, new TaskQuery()).getResult()) {
+                for (final AbstractTaskTO taskTO : taskSyncopeOperations.list(taskType, new TaskQuery()).getResult()) {
                     taskTOs.add(taskTO);
                 }
                 taskResultManager.fromList(taskType, taskTOs);

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskRead.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskRead.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskRead.java
index 2538254..9e93d9e 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskRead.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskRead.java
@@ -39,7 +39,7 @@ public class TaskRead extends AbstractTaskCommand {
             final LinkedList<AbstractTaskTO> taskTOs = new LinkedList<>();
             for (final String parameter : input.getParameters()) {
                 try {
-                    taskTOs.add(taskService.read(Long.valueOf(parameter)));
+                    taskTOs.add(taskSyncopeOperations.read(parameter));
                 } catch (final NumberFormatException ex) {
                     taskResultManager.notBooleanDeletedError("task", parameter);
                 } catch (final SyncopeClientException | WebServiceException ex) {

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskRunningJobs.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskRunningJobs.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskRunningJobs.java
index fdb886f..d3a7e93 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskRunningJobs.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskRunningJobs.java
@@ -19,13 +19,12 @@
 package org.apache.syncope.client.cli.commands.task;
 
 import org.apache.syncope.common.lib.SyncopeClientException;
-import org.apache.syncope.common.lib.types.JobStatusType;
 
 public class TaskRunningJobs extends AbstractTaskCommand {
 
     public void list() {
         try {
-            taskResultManager.printTaskExecTO(taskService.listJobs(JobStatusType.RUNNING));
+            taskResultManager.printTaskExecTO(taskSyncopeOperations.listRunningJobs());
         } catch (final SyncopeClientException ex) {
             taskResultManager.generic(ex.getMessage());
         }

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskScheduledJobs.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskScheduledJobs.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskScheduledJobs.java
index d95f122..c4798d5 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskScheduledJobs.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskScheduledJobs.java
@@ -19,13 +19,12 @@
 package org.apache.syncope.client.cli.commands.task;
 
 import org.apache.syncope.common.lib.SyncopeClientException;
-import org.apache.syncope.common.lib.types.JobStatusType;
 
 public class TaskScheduledJobs extends AbstractTaskCommand {
 
     public void list() {
         try {
-            taskResultManager.printTaskExecTO(taskService.listJobs(JobStatusType.SCHEDULED));
+            taskResultManager.printTaskExecTO(taskSyncopeOperations.listScheduledJobs());
         } catch (final SyncopeClientException ex) {
             taskResultManager.generic(ex.getMessage());
         }

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskSyncopeOperations.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskSyncopeOperations.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskSyncopeOperations.java
new file mode 100644
index 0000000..6b819e9
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskSyncopeOperations.java
@@ -0,0 +1,66 @@
+/*
+ * 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.task;
+
+import java.util.List;
+import org.apache.syncope.client.cli.SyncopeServices;
+import org.apache.syncope.common.lib.to.AbstractTaskTO;
+import org.apache.syncope.common.lib.to.PagedResult;
+import org.apache.syncope.common.lib.to.TaskExecTO;
+import org.apache.syncope.common.lib.types.JobStatusType;
+import org.apache.syncope.common.lib.types.TaskType;
+import org.apache.syncope.common.rest.api.beans.TaskQuery;
+import org.apache.syncope.common.rest.api.service.TaskService;
+
+public class TaskSyncopeOperations {
+
+    private final TaskService taskService = SyncopeServices.get(TaskService.class);
+
+    public List<TaskExecTO> listScheduledJobs() {
+        return taskService.listJobs(JobStatusType.SCHEDULED);
+    }
+
+    public List<TaskExecTO> listRunningJobs() {
+        return taskService.listJobs(JobStatusType.RUNNING);
+    }
+
+    public <T extends AbstractTaskTO> T read(final String taskId) {
+        return taskService.read(Long.valueOf(taskId));
+    }
+
+    public void delete(final String taskId) {
+        taskService.read(Long.valueOf(taskId));
+    }
+
+    public <T extends AbstractTaskTO> PagedResult<T> list(final TaskType type, final TaskQuery query) {
+        return taskService.list(type, query);
+    }
+
+    public TaskExecTO readExecution(final String executionId) {
+        return taskService.readExecution(Long.valueOf(executionId));
+    }
+
+    public void deleteExecution(final String executionId) {
+        taskService.deleteExecution(Long.valueOf(executionId));
+    }
+
+    public TaskExecTO execute(final String executionId, final boolean dryRun) {
+        return taskService.execute(Long.valueOf(executionId), dryRun);
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/AbstractUserCommand.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/AbstractUserCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/AbstractUserCommand.java
new file mode 100644
index 0000000..5a28a04
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/AbstractUserCommand.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.user;
+
+public abstract class AbstractUserCommand {
+
+    protected final UserSyncopeOperations userSyncopeOperations = new UserSyncopeOperations();
+
+    protected final UserResultManager userResultManager = new UserResultManager();
+
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserCommand.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserCommand.java
new file mode 100644
index 0000000..35c3941
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserCommand.java
@@ -0,0 +1,144 @@
+/*
+ * 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.user;
+
+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 = "user")
+public class UserCommand extends AbstractCommand {
+
+    private static final String HELP_MESSAGE = "Usage: user [options]\n"
+            + "  Options:\n"
+            + "    --help \n"
+            + "    --list \n"
+            + "    --count \n"
+            + "    --get-user-key\n"
+            + "       Syntax: --get-user-key {USER-ID} {USER-ID} [...]\n"
+            + "    --get-username\n"
+            + "       Syntax: --get-username {USERNAME} {USERNAME} [...]\n"
+            + "    --read \n"
+            + "       Syntax: --read {USER-ID} {USER-ID} [...]\n"
+            + "    --search-by-attribute \n"
+            + "       Syntax: --search-by-attribute {REALM} {ATTR-NAME}={ATTR-VALUE}\n"
+            + "    --search-by-role \n"
+            + "       Syntax: --search-by-role {REALM} {ROLE-ID}\n"
+            + "    --search-by-resource \n"
+            + "       Syntax: --search-by-resource {REALM} {RESOURCE-NAME}\n"
+            + "    --delete \n"
+            + "       Syntax: --delete {USER-ID} {USER-ID} [...]";
+
+    @Override
+    public void execute(final Input input) {
+        if (StringUtils.isBlank(input.getOption())) {
+            input.setOption(UserOptions.HELP.getOptionName());
+        }
+
+        switch (UserOptions.fromName(input.getOption())) {
+            case COUNT:
+                new UserCount(input).count();
+                break;
+            case LIST:
+                new UserList().list();
+                break;
+            case GET_BY_KEY:
+                new UserGetKey(input).get();
+                break;
+            case GET_BY_USERNAME:
+                new UserGetUsername(input).get();
+                break;
+            case READ:
+                new UserRead(input).read();
+                break;
+            case SEARCH_BY_ATTRIBUTE:
+                new UserSearchByAttribute(input).search();
+                break;
+            case SEARCH_BY_ROLE:
+                new UserSearchByRole(input).search();
+                break;
+            case SEARCH_BY_RESOURCE:
+                new UserSearchByResource(input).search();
+                break;
+            case DELETE:
+                new UserDelete(input).delete();
+                break;
+            case HELP:
+                System.out.println(HELP_MESSAGE);
+                break;
+            default:
+                new UserResultManager().defaultError(input.getOption(), HELP_MESSAGE);
+        }
+    }
+
+    @Override
+    public String getHelpMessage() {
+        return HELP_MESSAGE;
+    }
+
+    private enum UserOptions {
+
+        HELP("--help"),
+        COUNT("--count"),
+        LIST("--list"),
+        GET_BY_KEY("--get-user-key"),
+        GET_BY_USERNAME("--get-username"),
+        READ("--read"),
+        SEARCH_BY_ATTRIBUTE("--search-by-attribute"),
+        SEARCH_BY_ROLE("--search-by-role"),
+        SEARCH_BY_RESOURCE("--search-by-resource"),
+        DELETE("--delete");
+
+        private final String optionName;
+
+        UserOptions(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 UserOptions fromName(final String name) {
+            UserOptions optionToReturn = HELP;
+            for (final UserOptions option : UserOptions.values()) {
+                if (option.equalsOptionName(name)) {
+                    optionToReturn = option;
+                }
+            }
+            return optionToReturn;
+        }
+
+        public static List<String> toList() {
+            final List<String> options = new ArrayList<>();
+            for (final UserOptions value : values()) {
+                options.add(value.getOptionName());
+            }
+            return options;
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserCount.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserCount.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserCount.java
new file mode 100644
index 0000000..a9cff9e
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserCount.java
@@ -0,0 +1,43 @@
+/*
+ * 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.user;
+
+import org.apache.syncope.client.cli.Input;
+import org.apache.syncope.common.lib.SyncopeClientException;
+
+public class UserCount extends AbstractUserCommand {
+
+    private final Input input;
+
+    public UserCount(final Input input) {
+        this.input = input;
+    }
+
+    public void count() {
+        if (input.parameterNumber() == 0) {
+            try {
+                userResultManager.generic("Total users: " + userSyncopeOperations.count());
+            } catch (final SyncopeClientException ex) {
+                userResultManager.generic("Error: " + ex.getMessage());
+            }
+        } else {
+            userResultManager.generic("Error: unnecessary parameters " + input.listParameters());
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserDelete.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserDelete.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserDelete.java
new file mode 100644
index 0000000..817db6c
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserDelete.java
@@ -0,0 +1,55 @@
+/*
+ * 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.user;
+
+import javax.xml.ws.WebServiceException;
+import org.apache.syncope.client.cli.Input;
+import org.apache.syncope.common.lib.SyncopeClientException;
+
+public class UserDelete extends AbstractUserCommand {
+
+    private static final String DELETE_HELP_MESSAGE = "user --delete {USER-ID} {USER-ID} [...]";
+
+    private final Input input;
+
+    public UserDelete(final Input input) {
+        this.input = input;
+    }
+
+    public void delete() {
+        if (input.parameterNumber() >= 1) {
+            for (final String parameter : input.getParameters()) {
+                try {
+                    userSyncopeOperations.delete(parameter);
+                    userResultManager.deletedMessage("User", parameter);
+                } catch (final WebServiceException | SyncopeClientException ex) {
+                    if (ex.getMessage().startsWith("NotFound")) {
+                        userResultManager.notFoundError("User", parameter);
+                    } else {
+                        userResultManager.generic(ex.getMessage());
+                    }
+                } catch (final NumberFormatException ex) {
+                    userResultManager.numberFormatException("user", parameter);
+                }
+            }
+        } else {
+            userResultManager.commandOptionError(DELETE_HELP_MESSAGE);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserGetKey.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserGetKey.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserGetKey.java
new file mode 100644
index 0000000..d64a327
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserGetKey.java
@@ -0,0 +1,45 @@
+/*
+ * 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.user;
+
+import org.apache.syncope.client.cli.Input;
+import org.apache.syncope.common.lib.SyncopeClientException;
+
+public class UserGetKey extends AbstractUserCommand {
+
+    private static final String GET_HELP_MESSAGE = "user --get-user-key {USERNAME}";
+
+    private final Input input;
+
+    public UserGetKey(final Input input) {
+        this.input = input;
+    }
+
+    public void get() {
+        if (input.getParameters().length == 1) {
+            try {
+                userResultManager.generic(userSyncopeOperations.getIdFromUsername(input.firstParameter()));
+            } catch (final SyncopeClientException ex) {
+                userResultManager.generic("Error: " + ex.getMessage());
+            }
+        } else {
+            userResultManager.commandOptionError(GET_HELP_MESSAGE);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserGetUsername.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserGetUsername.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserGetUsername.java
new file mode 100644
index 0000000..a94b1df
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserGetUsername.java
@@ -0,0 +1,45 @@
+/*
+ * 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.user;
+
+import org.apache.syncope.client.cli.Input;
+import org.apache.syncope.common.lib.SyncopeClientException;
+
+public class UserGetUsername extends AbstractUserCommand {
+
+    private static final String GET_HELP_MESSAGE = "user --get-username {USER-ID}";
+
+    private final Input input;
+
+    public UserGetUsername(final Input input) {
+        this.input = input;
+    }
+
+    public void get() {
+        if (input.getParameters().length == 1) {
+            try {
+                userResultManager.generic(userSyncopeOperations.getUsernameFromId(input.firstParameter()));
+            } catch (final SyncopeClientException ex) {
+                userResultManager.generic("Error: " + ex.getMessage());
+            }
+        } else {
+            userResultManager.commandOptionError(GET_HELP_MESSAGE);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserList.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserList.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserList.java
new file mode 100644
index 0000000..4778cd2
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserList.java
@@ -0,0 +1,48 @@
+/*
+ * 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.user;
+
+import java.util.LinkedList;
+import java.util.Scanner;
+import org.apache.syncope.common.lib.SyncopeClientException;
+import org.apache.syncope.common.lib.to.PagedResult;
+import org.apache.syncope.common.lib.to.UserTO;
+
+public class UserList extends AbstractUserCommand {
+
+    public void list() {
+        try {
+            final Scanner scanIn = new Scanner(System.in);
+            System.out.println(
+                    "This operation could be print a lot of information "
+                    + "on your screen. Do you want to continue? [yes/no]");
+            final String answer = scanIn.nextLine();
+            if ("yes".equalsIgnoreCase(answer)) {
+                final PagedResult<UserTO> uResult = userSyncopeOperations.list();
+                userResultManager.toView(new LinkedList<>(uResult.getResult()));
+            } else if ("no".equalsIgnoreCase(answer)) {
+                userResultManager.generic("List operation skipped");
+            } else {
+                userResultManager.generic("Invalid parameter, please use [yes/no]");
+            }
+        } catch (final SyncopeClientException ex) {
+            userResultManager.generic(ex.getMessage());
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserRead.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserRead.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserRead.java
new file mode 100644
index 0000000..ae94409
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserRead.java
@@ -0,0 +1,60 @@
+/*
+ * 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.user;
+
+import java.util.LinkedList;
+import javax.xml.ws.WebServiceException;
+import org.apache.syncope.client.cli.Input;
+import org.apache.syncope.common.lib.SyncopeClientException;
+import org.apache.syncope.common.lib.to.UserTO;
+
+public class UserRead extends AbstractUserCommand {
+
+    private static final String READ_HELP_MESSAGE = "user --read {USER-ID} {USER-ID} [...]";
+
+    private final Input input;
+
+    public UserRead(final Input input) {
+        this.input = input;
+    }
+
+    public void read() {
+        if (input.getParameters().length >= 1) {
+            final LinkedList<UserTO> userTOs = new LinkedList<>();
+            for (final String parameter : input.getParameters()) {
+                try {
+                    userTOs.add(userSyncopeOperations.read(parameter));
+                } catch (final SyncopeClientException | WebServiceException ex) {
+                    if (ex.getMessage().startsWith("NotFound")) {
+                        userResultManager.notFoundError("Logger", parameter);
+                    } else {
+                        userResultManager.generic("Error: " + ex.getMessage());
+                    }
+                    break;
+                } catch (final NumberFormatException ex) {
+                    userResultManager.numberFormatException("user", parameter);
+                }
+            }
+            userResultManager.toView(userTOs);
+        } else {
+            userResultManager.commandOptionError(READ_HELP_MESSAGE);
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserResultManager.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserResultManager.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserResultManager.java
new file mode 100644
index 0000000..2ea0578
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserResultManager.java
@@ -0,0 +1,110 @@
+/*
+ * 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.user;
+
+import java.util.List;
+import java.util.Set;
+import org.apache.syncope.client.cli.commands.CommonsResultManager;
+import org.apache.syncope.common.lib.to.AttrTO;
+import org.apache.syncope.common.lib.to.PropagationStatus;
+import org.apache.syncope.common.lib.to.RelationshipTO;
+import org.apache.syncope.common.lib.to.UserTO;
+
+public class UserResultManager extends CommonsResultManager {
+
+    public void toView(final List<UserTO> userTOs) {
+        for (final UserTO userTO : userTOs) {
+            printUser(userTO);
+        }
+        System.out.println("");
+    }
+
+    private void printUser(final UserTO userTO) {
+        System.out.println(" > USER ID: " + userTO.getKey());
+        System.out.println("    username: " + userTO.getUsername());
+        System.out.println("    realm: " + userTO.getRealm());
+        System.out.println("    status: " + userTO.getStatus());
+        System.out.println("    RESOURCES: ");
+        printResource(userTO.getResources());
+        System.out.println("    ROLES: ");
+        printRole(userTO.getRoles());
+        System.out.println("    creation date: " + userTO.getCreationDate());
+        System.out.println("    change password date: " + userTO.getChangePwdDate());
+        System.out.println("    PLAIN ATTRIBUTES: ");
+        printAttributes(userTO.getPlainAttrs());
+        System.out.println("    DERIVED ATTRIBUTES: ");
+        printAttributes(userTO.getDerAttrs());
+        System.out.println("    VIRTUAL ATTRIBUTES: ");
+        printAttributes(userTO.getVirAttrs());
+        System.out.println("    creator: " + userTO.getCreator());
+        System.out.println("    last modifier: " + userTO.getLastModifier());
+        System.out.println("    token: " + userTO.getToken());
+        System.out.println("    token expiration time: " + userTO.getTokenExpireTime());
+        System.out.println("    last change: " + userTO.getLastChangeDate());
+        System.out.println("    last login: " + userTO.getLastLoginDate());
+        System.out.println("    failed logins: " + userTO.getFailedLogins());
+        System.out.println("PROPAGATIONS:");
+        printPropagationStatus(userTO.getPropagationStatusTOs());
+        System.out.println("RELATIONSHIPS:");
+        printRelationships(userTO.getRelationships());
+        System.out.println("    security question id: " + userTO.getSecurityQuestion());
+        System.out.println("    security question answer id: " + userTO.getSecurityAnswer());
+        System.out.println("");
+    }
+
+    private void printResource(final Set<String> resources) {
+        for (final String resource : resources) {
+            System.out.println("       - " + resource);
+        }
+    }
+
+    private void printRole(final List<Long> roles) {
+        for (final Long role : roles) {
+            System.out.println("       - " + role);
+        }
+    }
+
+    private void printAttributes(final Set<AttrTO> derAttrTOs) {
+        for (final AttrTO attrTO : derAttrTOs) {
+            final StringBuilder attributeSentence = new StringBuilder();
+            attributeSentence.append("       ")
+                    .append(attrTO.getSchema())
+                    .append(": ")
+                    .append(attrTO.getValues());
+            if (attrTO.isReadonly()) {
+                attributeSentence.append(" - is readonly.");
+            }
+            System.out.println(attributeSentence);
+        }
+    }
+
+    private void printPropagationStatus(final List<PropagationStatus> propagationStatuses) {
+        for (final PropagationStatus propagationStatus : propagationStatuses) {
+            System.out.println("       status: " + propagationStatus.getStatus());
+            System.out.println("       resource: " + propagationStatus.getResource());
+            System.out.println("       failure reason: " + propagationStatus.getFailureReason());
+        }
+    }
+
+    private void printRelationships(final List<RelationshipTO> relationshipTOs) {
+        for (final RelationshipTO relationshipTO : relationshipTOs) {
+            System.out.println("       type: " + relationshipTO.getType());
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserSearchByAttribute.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserSearchByAttribute.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserSearchByAttribute.java
new file mode 100644
index 0000000..18ac77e
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserSearchByAttribute.java
@@ -0,0 +1,69 @@
+/*
+ * 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.user;
+
+import java.util.List;
+import javax.xml.ws.WebServiceException;
+import org.apache.syncope.client.cli.Input;
+import org.apache.syncope.client.cli.commands.realm.RealmSyncopeOperations;
+import org.apache.syncope.common.lib.SyncopeClientException;
+import org.apache.syncope.common.lib.to.UserTO;
+
+public class UserSearchByAttribute extends AbstractUserCommand {
+
+    private static final String SEARCH_HELP_MESSAGE = "user --search-by-attribute {REALM} {ATTR-NAME}={ATTR-VALUE}";
+
+    private final Input input;
+
+    public UserSearchByAttribute(final Input input) {
+        this.input = input;
+    }
+
+    public void search() {
+        if (input.parameterNumber() >= 2) {
+            final String realm = input.firstParameter();
+            final Input.PairParameter pairParameter = input.toPairParameter(input.secondParameter());
+            final RealmSyncopeOperations realmSyncopeOperations = new RealmSyncopeOperations();
+            try {
+                List<UserTO> userTOs;
+                if (!realmSyncopeOperations.exists(realm)) {
+                    userResultManager.generic("Operation performed on root realm because " + realm + "does not exists");
+                }
+                userTOs = userSyncopeOperations.searchByAttribute(
+                        realm, pairParameter.getKey(), pairParameter.getValue());
+                if (userTOs == null || userTOs.isEmpty()) {
+                    userResultManager.generic("No users found with attribute "
+                            + pairParameter.getKey() + " and value " + pairParameter.getValue());
+                } else {
+                    userResultManager.toView(userTOs);
+                }
+            } catch (final WebServiceException | SyncopeClientException ex) {
+                if (ex.getMessage().startsWith("NotFound")) {
+                    userResultManager.notFoundError("User with " + pairParameter.getKey(), pairParameter.getValue());
+                } else {
+                    userResultManager.generic(ex.getMessage(), SEARCH_HELP_MESSAGE);
+                }
+            } catch (final IllegalArgumentException ex) {
+                userResultManager.generic(ex.getMessage(), SEARCH_HELP_MESSAGE);
+            }
+            userResultManager.commandOptionError(SEARCH_HELP_MESSAGE);
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserSearchByResource.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserSearchByResource.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserSearchByResource.java
new file mode 100644
index 0000000..6a22150
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserSearchByResource.java
@@ -0,0 +1,68 @@
+/*
+ * 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.user;
+
+import java.util.List;
+import javax.xml.ws.WebServiceException;
+import org.apache.syncope.client.cli.Input;
+import org.apache.syncope.client.cli.commands.realm.RealmSyncopeOperations;
+import org.apache.syncope.client.cli.commands.resource.ResourceSyncopeOperations;
+import org.apache.syncope.common.lib.SyncopeClientException;
+import org.apache.syncope.common.lib.to.UserTO;
+
+public class UserSearchByResource extends AbstractUserCommand {
+
+    private static final String SEARCH_HELP_MESSAGE = "user --search {REALM} {RESOURCE-NAME}";
+
+    private final Input input;
+
+    public UserSearchByResource(final Input input) {
+        this.input = input;
+    }
+
+    public void search() {
+        if (input.parameterNumber() == 2) {
+            final String realm = input.firstParameter();
+            final String resource = input.secondParameter();
+            final RealmSyncopeOperations realmSyncopeOperations = new RealmSyncopeOperations();
+            final ResourceSyncopeOperations resourceSyncopeOperations = new ResourceSyncopeOperations();
+            try {
+                List<UserTO> userTOs = null;
+                if (!realmSyncopeOperations.exists(realm)) {
+                    userResultManager.generic("Operation performed on root realm because " + realm + "does not exists");
+                }
+                if (!resourceSyncopeOperations.exists(resource)) {
+                    userResultManager.notFoundError("Resource", resource);
+                } else {
+                    userTOs = userSyncopeOperations.searchByResource(realm, resource);
+                }
+                if (userTOs == null || userTOs.isEmpty()) {
+                    userResultManager.generic("No users has " + resource + " assigned");
+                } else {
+                    userResultManager.toView(userTOs);
+                }
+            } catch (final WebServiceException | SyncopeClientException ex) {
+                userResultManager.generic(ex.getMessage(), SEARCH_HELP_MESSAGE);
+            }
+        } else {
+            userResultManager.commandOptionError(SEARCH_HELP_MESSAGE);
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserSearchByRole.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserSearchByRole.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserSearchByRole.java
new file mode 100644
index 0000000..789bacb
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserSearchByRole.java
@@ -0,0 +1,62 @@
+/*
+ * 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.user;
+
+import java.util.List;
+import javax.xml.ws.WebServiceException;
+import org.apache.syncope.client.cli.Input;
+import org.apache.syncope.client.cli.commands.realm.RealmSyncopeOperations;
+import org.apache.syncope.common.lib.SyncopeClientException;
+import org.apache.syncope.common.lib.to.UserTO;
+
+public class UserSearchByRole extends AbstractUserCommand {
+
+    private static final String SEARCH_HELP_MESSAGE = "user --search {REALM} {ROLE-ID}";
+
+    private final Input input;
+
+    public UserSearchByRole(final Input input) {
+        this.input = input;
+    }
+
+    public void search() {
+        if (input.parameterNumber() == 2) {
+            final String realm = input.firstParameter();
+            final String role = input.secondParameter();
+            final RealmSyncopeOperations realmSyncopeOperations = new RealmSyncopeOperations();
+            try {
+                List<UserTO> userTOs;
+                if (!realmSyncopeOperations.exists(realm)) {
+                    userResultManager.generic("Operation performed on root realm because " + realm + "does not exists");
+                }
+                userTOs = userSyncopeOperations.searchByRole(realm, input.secondParameter());
+                if (userTOs == null || userTOs.isEmpty()) {
+                    userResultManager.generic("No users has " + role + " assigned");
+                } else {
+                    userResultManager.toView(userTOs);
+                }
+            } catch (final WebServiceException | SyncopeClientException ex) {
+                userResultManager.generic(ex.getMessage(), SEARCH_HELP_MESSAGE);
+            }
+        } else {
+            userResultManager.commandOptionError(SEARCH_HELP_MESSAGE);
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserSyncopeOperations.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserSyncopeOperations.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserSyncopeOperations.java
new file mode 100644
index 0000000..0496d97
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserSyncopeOperations.java
@@ -0,0 +1,78 @@
+/*
+ * 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.user;
+
+import java.util.List;
+import org.apache.syncope.client.cli.SyncopeServices;
+import org.apache.syncope.client.lib.SyncopeClient;
+import org.apache.syncope.common.lib.to.PagedResult;
+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;
+
+public class UserSyncopeOperations {
+
+    private final UserService userService = SyncopeServices.get(UserService.class);
+
+    public List<UserTO> searchByRole(final String realm, final String role) {
+        return userService.search(
+                SyncopeClient.getAnySearchQueryBuilder().realm(realm).
+                fiql(SyncopeClient.getUserSearchConditionBuilder().inRoles(Long.valueOf(role))
+                        .query()).build()).getResult();
+    }
+
+    public List<UserTO> searchByResource(final String realm, final String resource) {
+        return userService.search(
+                SyncopeClient.getAnySearchQueryBuilder().realm(realm).
+                fiql(SyncopeClient.getUserSearchConditionBuilder().hasResources(resource)
+                        .query()).build()).getResult();
+    }
+
+    public List<UserTO> searchByAttribute(final String realm, final String attributeName, final String attributeValue) {
+        return userService.search(
+                SyncopeClient.getAnySearchQueryBuilder().realm(realm).
+                fiql(SyncopeClient.getUserSearchConditionBuilder().is(attributeName).equalTo(attributeValue)
+                        .query()).build()).getResult();
+    }
+
+    public PagedResult<UserTO> list() {
+        return userService.list(new AnyListQuery());
+    }
+
+    public UserTO read(final String userId) {
+        return userService.read(Long.valueOf(userId));
+    }
+
+    public void delete(final String userId) {
+        userService.delete(Long.valueOf(userId));
+    }
+
+    public int count() {
+        return list().getResult().size();
+    }
+
+    public String getUsernameFromId(final String userId) {
+        return userService.getUsername(Long.valueOf(userId)).getHeaderString(RESTHeaders.USERNAME);
+    }
+
+    public String getIdFromUsername(final String username) {
+        return userService.getUserKey(username).getHeaderString(RESTHeaders.USER_KEY);
+    }
+}


[2/2] syncope git commit: Fixed SYNCOPE-580, refactoring and added realm stack, SYNCOPE-158

Posted by ma...@apache.org.
Fixed SYNCOPE-580, refactoring and added realm stack, SYNCOPE-158


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

Branch: refs/heads/master
Commit: 47b9f64bd1aeb9ec9260f809a83c042cbf09b9fd
Parents: 7866cdb
Author: massi <ma...@tirasa.net>
Authored: Tue Oct 27 18:07:06 2015 +0100
Committer: massi <ma...@tirasa.net>
Committed: Tue Oct 27 18:07:24 2015 +0100

----------------------------------------------------------------------
 .../org/apache/syncope/client/cli/Input.java    |   6 +
 .../cli/commands/CommonsResultManager.java      |   2 +-
 .../AbstractConfigurationCommand.java           |   6 +-
 .../configuration/ConfigurationDelete.java      |   2 +-
 .../configuration/ConfigurationExport.java      |   2 +-
 .../configuration/ConfigurationGet.java         |   2 +-
 .../configuration/ConfigurationRead.java        |   2 +-
 .../ConfigurationSyncopeOperations.java         |  50 +++++++
 .../configuration/ConfigurationUpdate.java      |   4 +-
 .../connector/AbstractConnectorCommand.java     |   5 +-
 .../cli/commands/connector/ConnectorDelete.java |   4 +-
 .../cli/commands/connector/ConnectorList.java   |   2 +-
 .../connector/ConnectorListBundles.java         |   2 +-
 .../ConnectorListConfigurationProperties.java   |   4 +-
 .../cli/commands/connector/ConnectorRead.java   |   4 +-
 .../connector/ConnectorReadByResource.java      |   2 +-
 .../connector/ConnectorSyncopeOperations.java   |  50 +++++++
 .../commands/domain/AbstractDomainCommand.java  |   5 +-
 .../cli/commands/domain/DomainDelete.java       |   2 +-
 .../client/cli/commands/domain/DomainList.java  |   2 +-
 .../client/cli/commands/domain/DomainRead.java  |   4 +-
 .../domain/DomainSyncopeOperations.java         |  41 ++++++
 .../cli/commands/install/InstallSetup.java      |   3 +-
 .../commands/logger/AbstractLoggerCommand.java  |   7 +-
 .../cli/commands/logger/LoggerCreate.java       |   3 +-
 .../cli/commands/logger/LoggerDelete.java       |   3 +-
 .../client/cli/commands/logger/LoggerList.java  |   3 +-
 .../client/cli/commands/logger/LoggerRead.java  |   3 +-
 .../logger/LoggerSyncopeOperations.java         |  46 ++++++
 .../cli/commands/logger/LoggerUpdate.java       |   5 +-
 .../cli/commands/logger/LoggerUpdateAll.java    |   5 +-
 .../AbstractNotificationCommand.java            |   5 +-
 .../notification/NotificationDelete.java        |   2 +-
 .../commands/notification/NotificationList.java |   2 +-
 .../commands/notification/NotificationRead.java |   2 +-
 .../NotificationSyncopeOperations.java          |  41 ++++++
 .../commands/policy/AbstractPolicyCommand.java  |   7 +-
 .../cli/commands/policy/PolicyDelete.java       |   2 +-
 .../client/cli/commands/policy/PolicyList.java  |   2 +-
 .../client/cli/commands/policy/PolicyRead.java  |   2 +-
 .../policy/PolicySyncopeOperations.java         |  42 ++++++
 .../commands/realm/AbstractRealmCommand.java    |  27 ++++
 .../client/cli/commands/realm/RealmCommand.java |  96 +++++++++++++
 .../client/cli/commands/realm/RealmList.java    |  36 +++++
 .../cli/commands/realm/RealmResultManager.java  |  39 +++++
 .../commands/realm/RealmSyncopeOperations.java  |  44 ++++++
 .../commands/report/AbstractReportCommand.java  |   5 +-
 .../cli/commands/report/ReportDelete.java       |   4 +-
 .../commands/report/ReportDeleteExecution.java  |   4 +-
 .../cli/commands/report/ReportExecute.java      |   7 +-
 .../commands/report/ReportExportExecution.java  |  10 +-
 .../client/cli/commands/report/ReportList.java  |   2 +-
 .../cli/commands/report/ReportListJobs.java     |   2 +-
 .../client/cli/commands/report/ReportRead.java  |   4 +-
 .../commands/report/ReportReadExecution.java    |   4 +-
 .../report/ReportSyncopeOperations.java         |  65 +++++++++
 .../resource/AbstractResourceCommand.java       |   7 +-
 .../cli/commands/resource/ResourceDelete.java   |   4 +-
 .../cli/commands/resource/ResourceList.java     |   2 +-
 .../cli/commands/resource/ResourceRead.java     |   4 +-
 .../resource/ResourceResultManager.java         |   5 +-
 .../resource/ResourceSyncopeOperations.java     |  51 +++++++
 .../commands/schema/AbstractSchemaCommand.java  |   7 +-
 .../cli/commands/schema/SchemaDelete.java       |   2 +-
 .../client/cli/commands/schema/SchemaList.java  |   2 +-
 .../cli/commands/schema/SchemaListAll.java      |   2 +-
 .../cli/commands/schema/SchemaListDerived.java  |   3 +-
 .../cli/commands/schema/SchemaListPlain.java    |   3 +-
 .../cli/commands/schema/SchemaListVirtual.java  |   3 +-
 .../client/cli/commands/schema/SchemaRead.java  |   2 +-
 .../schema/SchemaSyncopeOperations.java         |  54 +++++++
 .../cli/commands/task/AbstractTaskCommand.java  |   5 +-
 .../client/cli/commands/task/TaskDelete.java    |   2 +-
 .../client/cli/commands/task/TaskExecute.java   |   4 +-
 .../cli/commands/task/TaskExecutionDelete.java  |   2 +-
 .../cli/commands/task/TaskExecutionRead.java    |   2 +-
 .../client/cli/commands/task/TaskList.java      |   2 +-
 .../client/cli/commands/task/TaskRead.java      |   2 +-
 .../cli/commands/task/TaskRunningJobs.java      |   3 +-
 .../cli/commands/task/TaskScheduledJobs.java    |   3 +-
 .../commands/task/TaskSyncopeOperations.java    |  66 +++++++++
 .../cli/commands/user/AbstractUserCommand.java  |  27 ++++
 .../client/cli/commands/user/UserCommand.java   | 144 +++++++++++++++++++
 .../client/cli/commands/user/UserCount.java     |  43 ++++++
 .../client/cli/commands/user/UserDelete.java    |  55 +++++++
 .../client/cli/commands/user/UserGetKey.java    |  45 ++++++
 .../cli/commands/user/UserGetUsername.java      |  45 ++++++
 .../client/cli/commands/user/UserList.java      |  48 +++++++
 .../client/cli/commands/user/UserRead.java      |  60 ++++++++
 .../cli/commands/user/UserResultManager.java    | 110 ++++++++++++++
 .../commands/user/UserSearchByAttribute.java    |  69 +++++++++
 .../cli/commands/user/UserSearchByResource.java |  68 +++++++++
 .../cli/commands/user/UserSearchByRole.java     |  62 ++++++++
 .../commands/user/UserSyncopeOperations.java    |  78 ++++++++++
 94 files changed, 1697 insertions(+), 136 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/Input.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/Input.java b/client/cli/src/main/java/org/apache/syncope/client/cli/Input.java
index 9314187..63d7952 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/Input.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/Input.java
@@ -18,6 +18,8 @@
  */
 package org.apache.syncope.client.cli;
 
+import java.util.Arrays;
+import java.util.List;
 import org.apache.syncope.client.cli.commands.AbstractCommand;
 import org.apache.syncope.client.cli.util.CommandUtils;
 
@@ -63,6 +65,10 @@ public class Input {
     public String[] getParameters() {
         return parameters;
     }
+    
+    public List<String> listParameters() {
+        return Arrays.asList(parameters);
+    }
 
     public String firstParameter() {
         return parameters[0];

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/CommonsResultManager.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/CommonsResultManager.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/CommonsResultManager.java
index 251297b..39c32e6 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/CommonsResultManager.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/CommonsResultManager.java
@@ -24,7 +24,7 @@ import org.apache.syncope.common.lib.types.ConnConfProperty;
 
 public abstract class CommonsResultManager {
 
-    public void managerNumberFormatException(final String what, final String key) {
+    public void numberFormatException(final String what, final String key) {
         Messages.printIdNotNumberDeletedMessage(what, key);
     }
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/AbstractConfigurationCommand.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/AbstractConfigurationCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/AbstractConfigurationCommand.java
index 2942c07..87f0b00 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/AbstractConfigurationCommand.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/AbstractConfigurationCommand.java
@@ -18,12 +18,10 @@
  */
 package org.apache.syncope.client.cli.commands.configuration;
 
-import org.apache.syncope.client.cli.SyncopeServices;
-import org.apache.syncope.common.rest.api.service.ConfigurationService;
-
 public abstract class AbstractConfigurationCommand {
 
-    protected final ConfigurationService configurationService = SyncopeServices.get(ConfigurationService.class);
+    protected final ConfigurationSyncopeOperations configurationSyncopeOperations
+            = new ConfigurationSyncopeOperations();
 
     protected final ConfigurationResultManager configurationResultManager = new ConfigurationResultManager();
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationDelete.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationDelete.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationDelete.java
index f308aa9..870cb27 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationDelete.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationDelete.java
@@ -36,7 +36,7 @@ public class ConfigurationDelete extends AbstractConfigurationCommand {
         if (input.parameterNumber() >= 1) {
             for (final String parameter : input.getParameters()) {
                 try {
-                    configurationService.delete(parameter);
+                    configurationSyncopeOperations.delete(parameter);
                     configurationResultManager.deletedMessage("Configuration", parameter);
                 } catch (final SyncopeClientException | WebServiceException ex) {
                     if (ex.getMessage().startsWith("NotFound")) {

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationExport.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationExport.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationExport.java
index 2e61c4f..d08677a 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationExport.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationExport.java
@@ -45,7 +45,7 @@ public class ConfigurationExport extends AbstractConfigurationCommand {
         if (input.parameterNumber() == 1) {
             try {
                 XMLUtils.createXMLFile(
-                        (SequenceInputStream) configurationService.export().getEntity(),
+                        (SequenceInputStream) configurationSyncopeOperations.export().getEntity(),
                         input.firstParameter() + EXPORT_FILE_NAME);
                 configurationResultManager.generic(
                         input.firstParameter() + EXPORT_FILE_NAME + " successfully created");

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationGet.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationGet.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationGet.java
index 2aa3ff4..3cad82d 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationGet.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationGet.java
@@ -27,7 +27,7 @@ public class ConfigurationGet extends AbstractConfigurationCommand {
 
     public void get() {
         try {
-            configurationResultManager.fromGet(new LinkedList<>(configurationService.list()));
+            configurationResultManager.fromGet(new LinkedList<>(configurationSyncopeOperations.list()));
         } catch (final Exception ex) {
             configurationResultManager.generic(ex.getMessage());
         }

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationRead.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationRead.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationRead.java
index c4294e7..5bccb3f 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationRead.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationRead.java
@@ -40,7 +40,7 @@ public class ConfigurationRead extends AbstractConfigurationCommand {
             boolean failed = false;
             for (final String parameter : input.getParameters()) {
                 try {
-                    attrList.add(configurationService.get(parameter));
+                    attrList.add(configurationSyncopeOperations.get(parameter));
                 } catch (final SyncopeClientException | WebServiceException ex) {
                     if (ex.getMessage().startsWith("NotFound")) {
                         configurationResultManager.notFoundError("Configuration", parameter);

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationSyncopeOperations.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationSyncopeOperations.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationSyncopeOperations.java
new file mode 100644
index 0000000..8efc97c
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationSyncopeOperations.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.configuration;
+
+import java.util.List;
+import javax.ws.rs.core.Response;
+import org.apache.syncope.client.cli.SyncopeServices;
+import org.apache.syncope.common.lib.to.AttrTO;
+import org.apache.syncope.common.rest.api.service.ConfigurationService;
+
+public class ConfigurationSyncopeOperations {
+
+    private final ConfigurationService configurationService = SyncopeServices.get(ConfigurationService.class);
+
+    public AttrTO get(final String schema) {
+        return configurationService.get(schema);
+    }
+
+    public void set(final AttrTO attrTO) {
+        configurationService.set(attrTO);
+    }
+
+    public List<AttrTO> list() {
+        return configurationService.list();
+    }
+
+    public Response export() {
+        return configurationService.export();
+    }
+
+    public void delete(final String schema) {
+        configurationService.delete(schema);
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationUpdate.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationUpdate.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationUpdate.java
index 295ebd1..2f85ffa 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationUpdate.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationUpdate.java
@@ -44,10 +44,10 @@ public class ConfigurationUpdate extends AbstractConfigurationCommand {
             for (final String parameter : input.getParameters()) {
                 try {
                     pairParameter = input.toPairParameter(parameter);
-                    attrTO = configurationService.get(pairParameter.getKey());
+                    attrTO = configurationSyncopeOperations.get(pairParameter.getKey());
                     attrTO.getValues().clear();
                     attrTO.getValues().add(pairParameter.getValue());
-                    configurationService.set(attrTO);
+                    configurationSyncopeOperations.set(attrTO);
                     attrList.add(attrTO);
                 } catch (final IllegalArgumentException ex) {
                     configurationResultManager.generic(ex.getMessage(), UPDATE_HELP_MESSAGE);

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/AbstractConnectorCommand.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/AbstractConnectorCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/AbstractConnectorCommand.java
index 0605c46..6286ed4 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/AbstractConnectorCommand.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/AbstractConnectorCommand.java
@@ -18,12 +18,9 @@
  */
 package org.apache.syncope.client.cli.commands.connector;
 
-import org.apache.syncope.client.cli.SyncopeServices;
-import org.apache.syncope.common.rest.api.service.ConnectorService;
-
 public abstract class AbstractConnectorCommand {
 
-    protected final ConnectorService connectorService = SyncopeServices.get(ConnectorService.class);
+    protected final ConnectorSyncopeOperations connectorSyncopeOperations = new ConnectorSyncopeOperations();
 
     protected final ConnectorResultManager connectorResultManager = new ConnectorResultManager();
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorDelete.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorDelete.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorDelete.java
index ab4c82e..6e26b9b 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorDelete.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorDelete.java
@@ -40,10 +40,10 @@ public class ConnectorDelete extends AbstractConnectorCommand {
             final List<ConnInstanceTO> connInstanceTOs = new ArrayList<>();
             for (final String parameter : input.getParameters()) {
                 try {
-                    connectorService.delete(Long.valueOf(parameter));
+                    connectorSyncopeOperations.delete(parameter);
                     connectorResultManager.deletedMessage("connector", parameter);
                 } catch (final NumberFormatException ex) {
-                    connectorResultManager.managerNumberFormatException("connector", parameter);
+                    connectorResultManager.numberFormatException("connector", parameter);
                 } catch (final SyncopeClientException | WebServiceException ex) {
                     if (ex.getMessage().startsWith("NotFound")) {
                         connectorResultManager.notFoundError("Connector", parameter);

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorList.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorList.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorList.java
index 7b6a3c6..f063228 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorList.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorList.java
@@ -24,7 +24,7 @@ public class ConnectorList extends AbstractConnectorCommand {
 
     public void list() {
         try {
-            connectorResultManager.toView(connectorService.list(null));
+            connectorResultManager.toView(connectorSyncopeOperations.list());
         } catch (final SyncopeClientException ex) {
             connectorResultManager.generic(ex.getMessage());
         }

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorListBundles.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorListBundles.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorListBundles.java
index 72a103d..d77cd83 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorListBundles.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorListBundles.java
@@ -24,7 +24,7 @@ public class ConnectorListBundles extends AbstractConnectorCommand {
 
     public void list() {
         try {
-            connectorResultManager.fromListBundles(connectorService.getBundles(null));
+            connectorResultManager.fromListBundles(connectorSyncopeOperations.getBundles());
         } catch (final SyncopeClientException ex) {
             connectorResultManager.generic(ex.getMessage());
         }

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorListConfigurationProperties.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorListConfigurationProperties.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorListConfigurationProperties.java
index 3e454d7..91a0021 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorListConfigurationProperties.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorListConfigurationProperties.java
@@ -38,9 +38,9 @@ public class ConnectorListConfigurationProperties extends AbstractConnectorComma
             for (final String parameter : input.getParameters()) {
                 try {
                     connectorResultManager.fromConfigurationProperties(
-                            connectorService.read(Long.valueOf(parameter), null).getConf());
+                            connectorSyncopeOperations.read(parameter).getConf());
                 } catch (final NumberFormatException ex) {
-                    connectorResultManager.managerNumberFormatException("connector", parameter);
+                    connectorResultManager.numberFormatException("connector", parameter);
                 } catch (final SyncopeClientException | WebServiceException ex) {
                     if (ex.getMessage().startsWith("NotFound")) {
                         connectorResultManager.notFoundError("Connector", parameter);

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorRead.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorRead.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorRead.java
index 46cbe84..e2dca1e 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorRead.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorRead.java
@@ -40,9 +40,9 @@ public class ConnectorRead extends AbstractConnectorCommand {
             final List<ConnInstanceTO> connInstanceTOs = new ArrayList<>();
             for (final String parameter : input.getParameters()) {
                 try {
-                    connInstanceTOs.add(connectorService.read(Long.valueOf(parameter), READ_HELP_MESSAGE));
+                    connInstanceTOs.add(connectorSyncopeOperations.read(parameter));
                 } catch (final NumberFormatException ex) {
-                    connectorResultManager.managerNumberFormatException("connector", parameter);
+                    connectorResultManager.numberFormatException("connector", parameter);
                 } catch (final SyncopeClientException | WebServiceException ex) {
                     if (ex.getMessage().startsWith("NotFound")) {
                         connectorResultManager.notFoundError("Connector", parameter);

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorReadByResource.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorReadByResource.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorReadByResource.java
index bd7797c..d062077 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorReadByResource.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorReadByResource.java
@@ -41,7 +41,7 @@ public class ConnectorReadByResource extends AbstractConnectorCommand {
             final List<ConnInstanceTO> connInstanceTOs = new ArrayList<>();
             for (final String parameter : input.getParameters()) {
                 try {
-                    connInstanceTOs.add(connectorService.readByResource(parameter, READ_HELP_MESSAGE));
+                    connInstanceTOs.add(connectorSyncopeOperations.readByResource(parameter));
                 } catch (final SyncopeClientException | WebServiceException ex) {
                     if (ex.getMessage().startsWith("NotFound")) {
                         connectorResultManager.notFoundError("Resource", parameter);

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorSyncopeOperations.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorSyncopeOperations.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorSyncopeOperations.java
new file mode 100644
index 0000000..b496063
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorSyncopeOperations.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.connector;
+
+import java.util.List;
+import org.apache.syncope.client.cli.SyncopeServices;
+import org.apache.syncope.common.lib.to.ConnBundleTO;
+import org.apache.syncope.common.lib.to.ConnInstanceTO;
+import org.apache.syncope.common.rest.api.service.ConnectorService;
+
+public class ConnectorSyncopeOperations {
+
+    protected final ConnectorService connectorService = SyncopeServices.get(ConnectorService.class);
+
+    public ConnInstanceTO readByResource(final String resourceName) {
+        return connectorService.readByResource(resourceName, null);
+    }
+
+    public ConnInstanceTO read(final String resourceId) {
+        return connectorService.read(Long.valueOf(resourceId), null);
+    }
+
+    public List<ConnBundleTO> getBundles() {
+        return connectorService.getBundles(null);
+    }
+
+    public List<ConnInstanceTO> list() {
+        return connectorService.list(null);
+    }
+
+    public void delete(final String resourceId) {
+        connectorService.delete(Long.valueOf(resourceId));
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/AbstractDomainCommand.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/AbstractDomainCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/AbstractDomainCommand.java
index b5bfca5..902f55c 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/AbstractDomainCommand.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/AbstractDomainCommand.java
@@ -18,12 +18,9 @@
  */
 package org.apache.syncope.client.cli.commands.domain;
 
-import org.apache.syncope.client.cli.SyncopeServices;
-import org.apache.syncope.common.rest.api.service.DomainService;
-
 public abstract class AbstractDomainCommand {
 
-    protected final DomainService domainService = SyncopeServices.get(DomainService.class);
+    protected final DomainSyncopeOperations domainSyncopeOperations = new DomainSyncopeOperations();
 
     protected final DomainResultManager domainResultManager = new DomainResultManager();
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainDelete.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainDelete.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainDelete.java
index 1b0c235..f85d3c9 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainDelete.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainDelete.java
@@ -35,7 +35,7 @@ public class DomainDelete extends AbstractDomainCommand {
         if (input.parameterNumber() >= 1) {
             for (final String parameter : input.getParameters()) {
                 try {
-                    domainService.delete(parameter);
+                    domainSyncopeOperations.delete(parameter);
                     domainResultManager.deletedMessage("Domain", parameter);
                 } catch (final SyncopeClientException ex) {
                     if (ex.getMessage().startsWith("NotFound")) {

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainList.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainList.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainList.java
index 94329d2..6cf7b7d 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainList.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainList.java
@@ -28,7 +28,7 @@ public class DomainList extends AbstractDomainCommand {
 
     public void list() {
         try {
-            for (final DomainTO domainTO : domainService.list()) {
+            for (final DomainTO domainTO : domainSyncopeOperations.list()) {
                 domainResultManager.generic(domainTO.getKey());
             }
         } catch (final SyncopeClientException ex) {

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainRead.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainRead.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainRead.java
index a76711d..2eaa75a 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainRead.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainRead.java
@@ -20,7 +20,6 @@ package org.apache.syncope.client.cli.commands.domain;
 
 import org.apache.syncope.client.cli.Input;
 import org.apache.syncope.common.lib.SyncopeClientException;
-import org.apache.syncope.common.lib.to.DomainTO;
 
 public class DomainRead extends AbstractDomainCommand {
 
@@ -36,8 +35,7 @@ public class DomainRead extends AbstractDomainCommand {
         if (input.parameterNumber() >= 1) {
             for (final String parameter : input.getParameters()) {
                 try {
-                    final DomainTO domainTO = domainService.read(parameter);
-                    domainResultManager.generic(domainTO.getKey());
+                    domainResultManager.generic(domainSyncopeOperations.read(parameter).getKey());
                 } catch (final SyncopeClientException ex) {
                     if (ex.getMessage().startsWith("NotFound")) {
                         domainResultManager.notFoundError("Domain", parameter);

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainSyncopeOperations.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainSyncopeOperations.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainSyncopeOperations.java
new file mode 100644
index 0000000..994c217
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainSyncopeOperations.java
@@ -0,0 +1,41 @@
+/*
+ * 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.domain;
+
+import java.util.List;
+import org.apache.syncope.client.cli.SyncopeServices;
+import org.apache.syncope.common.lib.to.DomainTO;
+import org.apache.syncope.common.rest.api.service.DomainService;
+
+public class DomainSyncopeOperations {
+
+    private final DomainService domainService = SyncopeServices.get(DomainService.class);
+
+    public DomainTO read(final String domainName) {
+        return domainService.read(domainName);
+    }
+
+    public List<DomainTO> list() {
+        return domainService.list();
+    }
+    
+    public void delete(final String domainName) {
+        domainService.delete(domainName);
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/install/InstallSetup.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/install/InstallSetup.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/install/InstallSetup.java
index 10995b0..4d9a0ff 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/install/InstallSetup.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/install/InstallSetup.java
@@ -48,8 +48,6 @@ public class InstallSetup {
     }
 
     public void setup() {
-        final Scanner scanIn = new Scanner(System.in);
-
         System.out.println("");
         System.out.println("###############################################");
         System.out.println("#                                             #");
@@ -67,6 +65,7 @@ public class InstallSetup {
         System.out.println("- File system permission checked");
         System.out.println("");
 
+        final Scanner scanIn = new Scanner(System.in);
         System.out.println("Syncope server schema [http/https]:");
         String syncopeServerSchemaFromSystemIn = scanIn.nextLine();
         boolean schemaFounded = false;

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/AbstractLoggerCommand.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/AbstractLoggerCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/AbstractLoggerCommand.java
index a8703a9..3e0978a 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/AbstractLoggerCommand.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/AbstractLoggerCommand.java
@@ -18,13 +18,10 @@
  */
 package org.apache.syncope.client.cli.commands.logger;
 
-import org.apache.syncope.client.cli.SyncopeServices;
-import org.apache.syncope.common.rest.api.service.LoggerService;
-
 public abstract class AbstractLoggerCommand {
 
-    protected final LoggerService loggerService = SyncopeServices.get(LoggerService.class);
-    
+    protected final LoggerSyncopeOperations loggerSyncopeOperations = new LoggerSyncopeOperations();
+
     protected final LoggerResultManager loggerResultManager = new LoggerResultManager();
 
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerCreate.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerCreate.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerCreate.java
index 6a51e95..40b5e1b 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerCreate.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerCreate.java
@@ -25,7 +25,6 @@ import org.apache.syncope.client.cli.util.CommandUtils;
 import org.apache.syncope.common.lib.SyncopeClientException;
 import org.apache.syncope.common.lib.to.LoggerTO;
 import org.apache.syncope.common.lib.types.LoggerLevel;
-import org.apache.syncope.common.lib.types.LoggerType;
 
 public class LoggerCreate extends AbstractLoggerCommand {
 
@@ -50,7 +49,7 @@ public class LoggerCreate extends AbstractLoggerCommand {
                     pairParameter = input.toPairParameter(parameter);
                     loggerTO.setKey(pairParameter.getKey());
                     loggerTO.setLevel(LoggerLevel.valueOf(pairParameter.getValue()));
-                    loggerService.update(LoggerType.LOG, loggerTO);
+                    loggerSyncopeOperations.update(loggerTO);
                     loggerTOs.add(loggerTO);
                 } catch (final WebServiceException | SyncopeClientException | IllegalArgumentException ex) {
                     loggerResultManager.typeNotValidError(

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerDelete.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerDelete.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerDelete.java
index 5815b71..8bdb3ab 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerDelete.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerDelete.java
@@ -21,7 +21,6 @@ package org.apache.syncope.client.cli.commands.logger;
 import javax.xml.ws.WebServiceException;
 import org.apache.syncope.client.cli.Input;
 import org.apache.syncope.common.lib.SyncopeClientException;
-import org.apache.syncope.common.lib.types.LoggerType;
 
 public class LoggerDelete extends AbstractLoggerCommand {
 
@@ -37,7 +36,7 @@ public class LoggerDelete extends AbstractLoggerCommand {
         if (input.parameterNumber() >= 1) {
             for (final String parameter : input.getParameters()) {
                 try {
-                    loggerService.delete(LoggerType.LOG, parameter);
+                    loggerSyncopeOperations.delete(parameter);
                     loggerResultManager.deletedMessage("Logger", parameter);
                 } catch (final WebServiceException | SyncopeClientException ex) {
                     if (ex.getMessage().startsWith("NotFound")) {

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerList.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerList.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerList.java
index d9d4f81..b64eef6 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerList.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerList.java
@@ -20,7 +20,6 @@ package org.apache.syncope.client.cli.commands.logger;
 
 import java.util.LinkedList;
 import org.apache.syncope.common.lib.SyncopeClientException;
-import org.apache.syncope.common.lib.types.LoggerType;
 
 public class LoggerList extends AbstractLoggerCommand {
 
@@ -29,7 +28,7 @@ public class LoggerList extends AbstractLoggerCommand {
 
     public void list() {
         try {
-            loggerResultManager.fromList(new LinkedList<>(loggerService.list(LoggerType.LOG)));
+            loggerResultManager.fromList(new LinkedList<>(loggerSyncopeOperations.list()));
         } catch (final SyncopeClientException ex) {
             loggerResultManager.generic("Error: " + ex.getMessage());
         }

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerRead.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerRead.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerRead.java
index 6e2447d..1192252 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerRead.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerRead.java
@@ -23,7 +23,6 @@ import javax.xml.ws.WebServiceException;
 import org.apache.syncope.client.cli.Input;
 import org.apache.syncope.common.lib.SyncopeClientException;
 import org.apache.syncope.common.lib.to.LoggerTO;
-import org.apache.syncope.common.lib.types.LoggerType;
 
 public class LoggerRead extends AbstractLoggerCommand {
 
@@ -41,7 +40,7 @@ public class LoggerRead extends AbstractLoggerCommand {
             boolean failed = false;
             for (final String parameter : input.getParameters()) {
                 try {
-                    loggerTOs.add(loggerService.read(LoggerType.LOG, parameter));
+                    loggerTOs.add(loggerSyncopeOperations.read(parameter));
                 } catch (final SyncopeClientException | WebServiceException ex) {
                     if (ex.getMessage().startsWith("NotFound")) {
                         loggerResultManager.notFoundError("Logger", parameter);

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerSyncopeOperations.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerSyncopeOperations.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerSyncopeOperations.java
new file mode 100644
index 0000000..14b7d18
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerSyncopeOperations.java
@@ -0,0 +1,46 @@
+/*
+ * 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.logger;
+
+import java.util.List;
+import org.apache.syncope.client.cli.SyncopeServices;
+import org.apache.syncope.common.lib.to.LoggerTO;
+import org.apache.syncope.common.lib.types.LoggerType;
+import org.apache.syncope.common.rest.api.service.LoggerService;
+
+public class LoggerSyncopeOperations {
+
+    private final LoggerService loggerService = SyncopeServices.get(LoggerService.class);
+
+    public List<LoggerTO> list() {
+        return loggerService.list(LoggerType.LOG);
+    }
+
+    public void update(final LoggerTO loggerTO) {
+        loggerService.update(LoggerType.LOG, loggerTO);
+    }
+
+    public LoggerTO read(final String loggerName) {
+        return loggerService.read(LoggerType.LOG, loggerName);
+    }
+    
+    public void delete(final String loggerName) {
+        loggerService.delete(LoggerType.LOG, loggerName);
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerUpdate.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerUpdate.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerUpdate.java
index 03de917..9a45916 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerUpdate.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerUpdate.java
@@ -25,7 +25,6 @@ import org.apache.syncope.client.cli.util.CommandUtils;
 import org.apache.syncope.common.lib.SyncopeClientException;
 import org.apache.syncope.common.lib.to.LoggerTO;
 import org.apache.syncope.common.lib.types.LoggerLevel;
-import org.apache.syncope.common.lib.types.LoggerType;
 
 public class LoggerUpdate extends AbstractLoggerCommand {
 
@@ -47,9 +46,9 @@ public class LoggerUpdate extends AbstractLoggerCommand {
             for (final String parameter : input.getParameters()) {
                 try {
                     pairParameter = input.toPairParameter(parameter);
-                    loggerTO = loggerService.read(LoggerType.LOG, pairParameter.getKey());
+                    loggerTO = loggerSyncopeOperations.read(pairParameter.getKey());
                     loggerTO.setLevel(LoggerLevel.valueOf(pairParameter.getValue()));
-                    loggerService.update(LoggerType.LOG, loggerTO);
+                    loggerSyncopeOperations.update(loggerTO);
                     loggerTOs.add(loggerTO);
                 } catch (final WebServiceException | SyncopeClientException | IllegalArgumentException ex) {
                     if (ex.getMessage().startsWith("No enum constant org.apache.syncope.common.lib.types.")) {

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerUpdateAll.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerUpdateAll.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerUpdateAll.java
index 55c2e60..83c8b9a 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerUpdateAll.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerUpdateAll.java
@@ -25,7 +25,6 @@ import org.apache.syncope.client.cli.util.CommandUtils;
 import org.apache.syncope.common.lib.SyncopeClientException;
 import org.apache.syncope.common.lib.to.LoggerTO;
 import org.apache.syncope.common.lib.types.LoggerLevel;
-import org.apache.syncope.common.lib.types.LoggerType;
 
 public class LoggerUpdateAll extends AbstractLoggerCommand {
 
@@ -41,10 +40,10 @@ public class LoggerUpdateAll extends AbstractLoggerCommand {
         if (input.parameterNumber() == 1) {
             final LinkedList<LoggerTO> loggerTOs = new LinkedList<>();
             boolean failed = false;
-            for (final LoggerTO loggerTO : loggerService.list(LoggerType.LOG)) {
+            for (final LoggerTO loggerTO : loggerSyncopeOperations.list()) {
                 try {
                     loggerTO.setLevel(LoggerLevel.valueOf(input.firstParameter()));
-                    loggerService.update(LoggerType.LOG, loggerTO);
+                    loggerSyncopeOperations.update(loggerTO);
                     loggerTOs.add(loggerTO);
                 } catch (final WebServiceException | SyncopeClientException | IllegalArgumentException ex) {
                     if (ex.getMessage().startsWith("No enum constant org.apache.syncope.common.lib.types.")) {

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/AbstractNotificationCommand.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/AbstractNotificationCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/AbstractNotificationCommand.java
index 2b862ed..a21f2cd 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/AbstractNotificationCommand.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/AbstractNotificationCommand.java
@@ -18,12 +18,9 @@
  */
 package org.apache.syncope.client.cli.commands.notification;
 
-import org.apache.syncope.client.cli.SyncopeServices;
-import org.apache.syncope.common.rest.api.service.NotificationService;
-
 public abstract class AbstractNotificationCommand {
 
-    protected final NotificationService notificationService = SyncopeServices.get(NotificationService.class);
+    protected final NotificationSyncopeOperations notificationSyncopeOperations = new NotificationSyncopeOperations();
     
     protected final NotificationResultManager notificationResultManager = new NotificationResultManager();
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationDelete.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationDelete.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationDelete.java
index 2e0e5cd..3b11a5a 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationDelete.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationDelete.java
@@ -37,7 +37,7 @@ public class NotificationDelete extends AbstractNotificationCommand {
         if (input.parameterNumber() >= 1) {
             for (final String parameter : input.getParameters()) {
                 try {
-                    notificationService.delete(Long.valueOf(parameter));
+                    notificationSyncopeOperations.delete(parameter);
                     notificationResultManager.deletedMessage("Notification", parameter);
                 } catch (final WebServiceException | SyncopeClientException ex) {
                     if (ex.getMessage().startsWith("NotFound")) {

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationList.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationList.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationList.java
index ff9561c..3df5d64 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationList.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationList.java
@@ -25,7 +25,7 @@ public class NotificationList extends AbstractNotificationCommand {
 
     public void list() {
         try {
-            for (final NotificationTO notificationTO : notificationService.list()) {
+            for (final NotificationTO notificationTO : notificationSyncopeOperations.list()) {
                 System.out.println(notificationTO);
             }
         } catch (final SyncopeClientException ex) {

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationRead.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationRead.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationRead.java
index 386700c..bd82663 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationRead.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationRead.java
@@ -36,7 +36,7 @@ public class NotificationRead extends AbstractNotificationCommand {
         if (input.parameterNumber() >= 1) {
             for (final String parameter : input.getParameters()) {
                 try {
-                    System.out.println(notificationService.read(Long.valueOf(parameter)));
+                    System.out.println(notificationSyncopeOperations.read(parameter));
                 } catch (final NumberFormatException ex) {
                     notificationResultManager.notBooleanDeletedError("notification", parameter);
                 } catch (final WebServiceException | SyncopeClientException ex) {

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationSyncopeOperations.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationSyncopeOperations.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationSyncopeOperations.java
new file mode 100644
index 0000000..cb11cb5
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationSyncopeOperations.java
@@ -0,0 +1,41 @@
+/*
+ * 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.notification;
+
+import java.util.List;
+import org.apache.syncope.client.cli.SyncopeServices;
+import org.apache.syncope.common.lib.to.NotificationTO;
+import org.apache.syncope.common.rest.api.service.NotificationService;
+
+public class NotificationSyncopeOperations {
+
+    private final NotificationService notificationService = SyncopeServices.get(NotificationService.class);
+
+    public NotificationTO read(final String notificationId) {
+        return notificationService.read(Long.valueOf(notificationId));
+    }
+
+    public List<NotificationTO> list() {
+        return notificationService.list();
+    }
+
+    public void delete(final String notificationId) {
+        notificationService.delete(Long.valueOf(notificationId));
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/AbstractPolicyCommand.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/AbstractPolicyCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/AbstractPolicyCommand.java
index 0bab4e5..0c8a55f 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/AbstractPolicyCommand.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/AbstractPolicyCommand.java
@@ -18,13 +18,10 @@
  */
 package org.apache.syncope.client.cli.commands.policy;
 
-import org.apache.syncope.client.cli.SyncopeServices;
-import org.apache.syncope.common.rest.api.service.PolicyService;
-
 public abstract class AbstractPolicyCommand {
 
-    protected final PolicyService policyService = SyncopeServices.get(PolicyService.class);
-    
+    protected final PolicySyncopeOperations policySyncopeOperations = new PolicySyncopeOperations();
+
     protected final PolicyResultManager policyResultManager = new PolicyResultManager();
 
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyDelete.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyDelete.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyDelete.java
index 15ffa8d..8f9ede3 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyDelete.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyDelete.java
@@ -36,7 +36,7 @@ public class PolicyDelete extends AbstractPolicyCommand {
         if (input.parameterNumber() >= 1) {
             for (final String parameter : input.getParameters()) {
                 try {
-                    policyService.delete(Long.valueOf(parameter));
+                    policySyncopeOperations.delete(parameter);
                     policyResultManager.deletedMessage("Policy", parameter);
                 } catch (final WebServiceException | SyncopeClientException ex) {
                     System.out.println("Error:");

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyList.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyList.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyList.java
index c05acf7..4b672d6 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyList.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyList.java
@@ -42,7 +42,7 @@ public class PolicyList extends AbstractPolicyCommand {
             try {
                 final PolicyType policyType = PolicyType.valueOf(input.firstParameter());
                 final LinkedList<AbstractPolicyTO> policyTOs = new LinkedList<>();
-                for (final AbstractPolicyTO policyTO : policyService.list(policyType)) {
+                for (final AbstractPolicyTO policyTO : policySyncopeOperations.list(policyType)) {
                     policyTOs.add(policyTO);
                 }
                 policyResultManager.fromList(policyType, policyTOs);

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyRead.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyRead.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyRead.java
index f20d41e..25c9306 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyRead.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyRead.java
@@ -39,7 +39,7 @@ public class PolicyRead extends AbstractPolicyCommand {
             final LinkedList<AbstractPolicyTO> policyTOs = new LinkedList<>();
             for (final String parameter : input.getParameters()) {
                 try {
-                    policyTOs.add(policyService.read(Long.valueOf(parameter)));
+                    policyTOs.add(policySyncopeOperations.read(parameter));
                     policyResultManager.fromRead(policyTOs);
                 } catch (final NumberFormatException ex) {
                     policyResultManager.notBooleanDeletedError("policy", parameter);

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicySyncopeOperations.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicySyncopeOperations.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicySyncopeOperations.java
new file mode 100644
index 0000000..7c478f8
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicySyncopeOperations.java
@@ -0,0 +1,42 @@
+/*
+ * 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.policy;
+
+import java.util.List;
+import org.apache.syncope.client.cli.SyncopeServices;
+import org.apache.syncope.common.lib.policy.AbstractPolicyTO;
+import org.apache.syncope.common.lib.types.PolicyType;
+import org.apache.syncope.common.rest.api.service.PolicyService;
+
+public class PolicySyncopeOperations {
+
+    private final PolicyService policyService = SyncopeServices.get(PolicyService.class);
+
+    public <T extends AbstractPolicyTO> T read(final String policyId) {
+        return policyService.read(Long.valueOf(policyId));
+    }
+
+    public <T extends AbstractPolicyTO> List<T> list(final PolicyType policyType) {
+        return policyService.list(policyType);
+    }
+
+    public void delete(final String policyId) {
+        policyService.delete(Long.valueOf(policyId));
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/AbstractRealmCommand.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/AbstractRealmCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/AbstractRealmCommand.java
new file mode 100644
index 0000000..06cd1ba
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/AbstractRealmCommand.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.realm;
+
+public abstract class AbstractRealmCommand {
+
+    protected final RealmSyncopeOperations realmSyncopeOperations = new RealmSyncopeOperations();
+
+    protected final RealmResultManager realmResultManager = new RealmResultManager();
+
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/RealmCommand.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/RealmCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/RealmCommand.java
new file mode 100644
index 0000000..6a32562
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/RealmCommand.java
@@ -0,0 +1,96 @@
+/*
+ * 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.realm;
+
+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 = "realm")
+public class RealmCommand extends AbstractCommand {
+
+    private static final String HELP_MESSAGE = "Usage: realm [options]\n"
+            + "  Options:\n"
+            + "    --help \n"
+            + "    --list \n";
+
+    @Override
+    public void execute(final Input input) {
+        if (StringUtils.isBlank(input.getOption())) {
+            input.setOption(Options.HELP.getOptionName());
+        }
+        switch (Options.fromName(input.getOption())) {
+            case LIST:
+                new RealmList().list();
+                break;
+            case HELP:
+                System.out.println(HELP_MESSAGE);
+                break;
+            default:
+                new RealmResultManager().deletedMessage(input.getOption(), HELP_MESSAGE);
+        }
+    }
+
+    @Override
+    public String getHelpMessage() {
+        return HELP_MESSAGE;
+    }
+
+    private enum Options {
+
+        HELP("--help"),
+        LIST("--list");
+
+        private final String optionName;
+
+        Options(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 Options fromName(final String name) {
+            Options optionToReturn = HELP;
+            for (final Options option : Options.values()) {
+                if (option.equalsOptionName(name)) {
+                    optionToReturn = option;
+                }
+            }
+            return optionToReturn;
+        }
+
+        public static List<String> toList() {
+            final List<String> options = new ArrayList<>();
+            for (final Options value : values()) {
+                options.add(value.getOptionName());
+            }
+            return options;
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/RealmList.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/RealmList.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/RealmList.java
new file mode 100644
index 0000000..5d4b902
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/RealmList.java
@@ -0,0 +1,36 @@
+/*
+ * 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.realm;
+
+import org.apache.syncope.common.lib.SyncopeClientException;
+
+public class RealmList extends AbstractRealmCommand {
+
+    public RealmList() {
+    }
+
+    public void list() {
+        try {
+            realmResultManager.toView(realmSyncopeOperations.list());
+        } catch (final SyncopeClientException ex) {
+            realmResultManager.generic("Error: " + ex.getMessage());
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/RealmResultManager.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/RealmResultManager.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/RealmResultManager.java
new file mode 100644
index 0000000..bbb46d9
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/RealmResultManager.java
@@ -0,0 +1,39 @@
+/*
+ * 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.realm;
+
+import java.util.List;
+import org.apache.syncope.client.cli.commands.CommonsResultManager;
+import org.apache.syncope.common.lib.to.RealmTO;
+
+public class RealmResultManager extends CommonsResultManager {
+
+    public void toView(final List<RealmTO> realmTOs) {
+        for (final RealmTO realmTO : realmTOs) {
+            System.out.println(" > REALM ID: " + realmTO.getKey());
+            System.out.println("    name: " + realmTO.getName());
+            System.out.println("    full path: " + realmTO.getFullPath());
+            System.out.println("    actions: " + realmTO.getActionsClassNames());
+            System.out.println("    templates: " + realmTO.getTemplates());
+            System.out.println("    parent id: " + realmTO.getParent());
+            System.out.println("    account policy id: " + realmTO.getAccountPolicy());
+            System.out.println("    password policy id: " + realmTO.getPasswordPolicy());
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/RealmSyncopeOperations.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/RealmSyncopeOperations.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/RealmSyncopeOperations.java
new file mode 100644
index 0000000..e9d0b65
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/RealmSyncopeOperations.java
@@ -0,0 +1,44 @@
+/*
+ * 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.realm;
+
+import java.util.List;
+import org.apache.syncope.client.cli.SyncopeServices;
+import org.apache.syncope.common.lib.to.RealmTO;
+import org.apache.syncope.common.rest.api.service.RealmService;
+
+public class RealmSyncopeOperations {
+
+    private final RealmService realmService = SyncopeServices.get(RealmService.class);
+
+    public List<RealmTO> list() {
+        return realmService.list();
+    }
+
+    public boolean exists(final String realm) {
+        boolean exists = false;
+        for (final RealmTO list : list()) {
+            if (list.getName().equals(realm)) {
+                exists = true;
+            }
+        }
+        return exists;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/AbstractReportCommand.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/AbstractReportCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/AbstractReportCommand.java
index e4c2394..38a7b2f 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/AbstractReportCommand.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/AbstractReportCommand.java
@@ -18,12 +18,9 @@
  */
 package org.apache.syncope.client.cli.commands.report;
 
-import org.apache.syncope.client.cli.SyncopeServices;
-import org.apache.syncope.common.rest.api.service.ReportService;
-
 public abstract class AbstractReportCommand {
 
-    protected final ReportService reportService = SyncopeServices.get(ReportService.class);
+    protected final ReportSyncopeOperations reportSyncopeOperations = new ReportSyncopeOperations();
 
     protected final ReportResultManager reportResultManager = new ReportResultManager();
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportDelete.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportDelete.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportDelete.java
index 012d04f..aa2c5f8 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportDelete.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportDelete.java
@@ -36,7 +36,7 @@ public class ReportDelete extends AbstractReportCommand {
         if (input.parameterNumber() >= 1) {
             for (final String parameter : input.getParameters()) {
                 try {
-                    reportService.delete(Long.valueOf(parameter));
+                    reportSyncopeOperations.delete(parameter);
                     reportResultManager.deletedMessage("Report", parameter);
                 } catch (final WebServiceException | SyncopeClientException ex) {
                     if (ex.getMessage().startsWith("NotFound")) {
@@ -47,7 +47,7 @@ public class ReportDelete extends AbstractReportCommand {
                         reportResultManager.generic(ex.getMessage());
                     }
                 } catch (final NumberFormatException ex) {
-                    reportResultManager.managerNumberFormatException("report", parameter);
+                    reportResultManager.numberFormatException("report", parameter);
                 }
             }
         } else {

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportDeleteExecution.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportDeleteExecution.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportDeleteExecution.java
index 4ab53fa..86f31a2 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportDeleteExecution.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportDeleteExecution.java
@@ -39,7 +39,7 @@ public class ReportDeleteExecution extends AbstractReportCommand {
             for (final String parameter : input.getParameters()) {
 
                 try {
-                    reportService.deleteExecution(Long.valueOf(parameter));
+                    reportSyncopeOperations.deleteExecution(parameter);
                     reportResultManager.deletedMessage("Report execution", parameter);
                 } catch (final WebServiceException | SyncopeClientException ex) {
                     if (ex.getMessage().startsWith("NotFound")) {
@@ -50,7 +50,7 @@ public class ReportDeleteExecution extends AbstractReportCommand {
                         reportResultManager.generic(ex.getMessage());
                     }
                 } catch (final NumberFormatException ex) {
-                    reportResultManager.managerNumberFormatException("report", parameter);
+                    reportResultManager.numberFormatException("report", parameter);
                 }
             }
         } else {

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportExecute.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportExecute.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportExecute.java
index 311544d..0641203 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportExecute.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportExecute.java
@@ -39,10 +39,9 @@ public class ReportExecute extends AbstractReportCommand {
         if (input.parameterNumber() == 1) {
 
             try {
-                final Long reportIdToExecute = Long.valueOf(input.firstParameter());
-                reportService.execute(reportIdToExecute);
+                reportSyncopeOperations.execute(input.firstParameter());
                 final List<ReportExecTO> executionList
-                        = reportService.read(reportIdToExecute).getExecutions();
+                        = reportSyncopeOperations.read(input.firstParameter()).getExecutions();
                 final ReportExecTO lastExecution = executionList.get(executionList.size() - 1);
                 reportResultManager.printReportExecution(Arrays.asList(lastExecution));
             } catch (final WebServiceException | SyncopeClientException ex) {
@@ -54,7 +53,7 @@ public class ReportExecute extends AbstractReportCommand {
                     reportResultManager.generic(ex.getMessage());
                 }
             } catch (final NumberFormatException ex) {
-                reportResultManager.managerNumberFormatException("report", input.firstParameter());
+                reportResultManager.numberFormatException("report", input.firstParameter());
             }
         } else {
             reportResultManager.commandOptionError(EXECUTE_HELP_MESSAGE);

http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportExportExecution.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportExportExecution.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportExportExecution.java
index c55d339..ae79e57 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportExportExecution.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportExportExecution.java
@@ -49,12 +49,11 @@ public class ReportExportExecution extends AbstractReportCommand {
             for (final String parameter : parameters) {
                 try {
                     final ReportExecExportFormat format = ReportExecExportFormat.valueOf(input.lastParameter());
-                    final Long exportId = Long.valueOf(parameter);
-                    final SequenceInputStream report = (SequenceInputStream) reportService.
-                            exportExecutionResult(exportId, format).getEntity();
+                    final SequenceInputStream report = (SequenceInputStream) reportSyncopeOperations.
+                            exportExecutionResult(parameter, format).getEntity();
                     switch (format) {
                         case XML:
-                            final String xmlFinalName = "export_" + exportId + ".xml";
+                            final String xmlFinalName = "export_" + parameter + ".xml";
                             XMLUtils.createXMLFile(report, xmlFinalName);
                             reportResultManager.generic(xmlFinalName + " successfully created");
                             break;
@@ -75,14 +74,13 @@ public class ReportExportExecution extends AbstractReportCommand {
                             break;
                     }
                 } catch (final WebServiceException | SyncopeClientException ex) {
-                    ex.printStackTrace();
                     if (ex.getMessage().startsWith("NotFound")) {
                         reportResultManager.notFoundError("Report", parameter);
                     } else {
                         reportResultManager.generic(ex.getMessage());
                     }
                 } catch (final NumberFormatException ex) {
-                    reportResultManager.managerNumberFormatException("report", parameter);
+                    reportResultManager.numberFormatException("report", parameter);
                 } catch (IOException | ParserConfigurationException | SAXException | TransformerException e) {
                     reportResultManager.generic(" - Error creating " + "export_" + parameter + " " + e.getMessage());
                 } catch (final IllegalArgumentException ex) {