You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by il...@apache.org on 2016/06/20 08:42:07 UTC

[3/3] syncope git commit: [SYNCOPE-873] Cleanup

[SYNCOPE-873] Cleanup


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

Branch: refs/heads/master
Commit: 649ba7743fd5fa8921722595244585d442b7c668
Parents: bb0be09
Author: Francesco Chicchiricc� <il...@apache.org>
Authored: Mon Jun 20 10:41:55 2016 +0200
Committer: Francesco Chicchiricc� <il...@apache.org>
Committed: Mon Jun 20 10:41:55 2016 +0200

----------------------------------------------------------------------
 .../anyobject/AnyObjectSyncopeOperations.java   |  7 +-
 .../commands/group/GroupSyncopeOperations.java  |  4 +-
 .../commands/user/UserSyncopeOperations.java    | 29 +++----
 .../client/console/commons/AnyDataProvider.java |  4 +-
 .../panels/search/AnyObjectSearchPanel.java     |  2 +-
 .../console/rest/AbstractAnyRestClient.java     |  7 +-
 .../console/rest/AnyObjectRestClient.java       | 26 +-----
 .../client/console/rest/GroupRestClient.java    | 24 +-----
 .../client/console/rest/UserRestClient.java     | 23 +-----
 .../client/console/wizards/any/Groups.java      |  3 +-
 .../enduser/resources/SyncopeGroupResource.java |  8 +-
 .../common/rest/api/beans/AnyListQuery.java     | 58 --------------
 .../syncope/common/rest/api/beans/AnyQuery.java | 38 ++++++++-
 .../common/rest/api/beans/AnySearchQuery.java   | 63 ---------------
 .../rest/api/service/AnyObjectService.java      | 20 -----
 .../common/rest/api/service/AnyService.java     |  7 +-
 .../common/rest/api/service/GroupService.java   | 13 ---
 .../common/rest/api/service/UserService.java    | 14 ----
 .../rest/cxf/service/AbstractAnyService.java    | 69 ++++++++--------
 .../rest/cxf/service/AnyObjectServiceImpl.java  | 28 ++-----
 .../core/rest/cxf/service/GroupServiceImpl.java |  7 --
 .../core/rest/cxf/service/UserServiceImpl.java  |  7 --
 .../syncope/fit/core/AnyObjectITCase.java       |  9 ++-
 .../syncope/fit/core/AuthenticationITCase.java  |  8 +-
 .../apache/syncope/fit/core/GroupITCase.java    |  9 +--
 .../syncope/fit/core/MembershipITCase.java      |  4 +-
 .../syncope/fit/core/MultitenancyITCase.java    |  5 +-
 .../apache/syncope/fit/core/PullTaskITCase.java | 30 +++----
 .../apache/syncope/fit/core/SearchITCase.java   | 83 +++++++-------------
 .../org/apache/syncope/fit/core/UserITCase.java | 14 ++--
 30 files changed, 180 insertions(+), 443 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/649ba774/client/cli/src/main/java/org/apache/syncope/client/cli/commands/anyobject/AnyObjectSyncopeOperations.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/anyobject/AnyObjectSyncopeOperations.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/anyobject/AnyObjectSyncopeOperations.java
index 4f06c5d..547fc9e 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/anyobject/AnyObjectSyncopeOperations.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/anyobject/AnyObjectSyncopeOperations.java
@@ -21,10 +21,11 @@ package org.apache.syncope.client.cli.commands.anyobject;
 import java.util.List;
 import java.util.Set;
 import org.apache.syncope.client.cli.SyncopeServices;
+import org.apache.syncope.client.lib.SyncopeClient;
 import org.apache.syncope.common.lib.to.AnyObjectTO;
 import org.apache.syncope.common.lib.to.AttrTO;
 import org.apache.syncope.common.lib.types.SchemaType;
-import org.apache.syncope.common.rest.api.beans.AnyListQuery;
+import org.apache.syncope.common.rest.api.beans.AnyQuery;
 import org.apache.syncope.common.rest.api.service.AnyObjectService;
 
 public class AnyObjectSyncopeOperations {
@@ -32,7 +33,9 @@ public class AnyObjectSyncopeOperations {
     private final AnyObjectService anyObjectService = SyncopeServices.get(AnyObjectService.class);
 
     public List<AnyObjectTO> list(final String type) {
-        return anyObjectService.list(type, new AnyListQuery()).getResult();
+        return anyObjectService.search(
+                new AnyQuery.Builder().fiql(SyncopeClient.getAnyObjectSearchConditionBuilder(type).query()).build()).
+                getResult();
     }
 
     public AnyObjectTO read(final String anyKey) {

http://git-wip-us.apache.org/repos/asf/syncope/blob/649ba774/client/cli/src/main/java/org/apache/syncope/client/cli/commands/group/GroupSyncopeOperations.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/group/GroupSyncopeOperations.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/group/GroupSyncopeOperations.java
index 8df8e8c..96e14cb 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/group/GroupSyncopeOperations.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/group/GroupSyncopeOperations.java
@@ -24,7 +24,7 @@ import org.apache.syncope.client.cli.SyncopeServices;
 import org.apache.syncope.common.lib.to.AttrTO;
 import org.apache.syncope.common.lib.to.GroupTO;
 import org.apache.syncope.common.lib.types.SchemaType;
-import org.apache.syncope.common.rest.api.beans.AnyListQuery;
+import org.apache.syncope.common.rest.api.beans.AnyQuery;
 import org.apache.syncope.common.rest.api.service.GroupService;
 
 public class GroupSyncopeOperations {
@@ -32,7 +32,7 @@ public class GroupSyncopeOperations {
     private final GroupService groupService = SyncopeServices.get(GroupService.class);
 
     public List<GroupTO> list() {
-        return groupService.list(new AnyListQuery()).getResult();
+        return groupService.search(new AnyQuery()).getResult();
     }
 
     public GroupTO read(final String groupKey) {

http://git-wip-us.apache.org/repos/asf/syncope/blob/649ba774/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
index f54540c..cc9101b 100644
--- 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
@@ -26,8 +26,7 @@ import org.apache.syncope.common.lib.to.BulkAction;
 import org.apache.syncope.common.lib.to.BulkActionResult;
 import org.apache.syncope.common.lib.to.PagedResult;
 import org.apache.syncope.common.lib.to.UserTO;
-import org.apache.syncope.common.rest.api.beans.AnyListQuery;
-import org.apache.syncope.common.rest.api.beans.AnySearchQuery;
+import org.apache.syncope.common.rest.api.beans.AnyQuery;
 import org.apache.syncope.common.rest.api.service.UserService;
 
 public class UserSyncopeOperations {
@@ -44,28 +43,23 @@ public class UserSyncopeOperations {
     }
 
     public List<UserTO> searchByRole(final String realm, final String role) {
-        return userService.search(
-                new AnySearchQuery.Builder().realm(realm).
-                fiql(SyncopeClient.getUserSearchConditionBuilder().inRoles(role)
-                        .query()).build()).getResult();
+        return userService.search(new AnyQuery.Builder().realm(realm).
+                fiql(SyncopeClient.getUserSearchConditionBuilder().inRoles(role).query()).build()).getResult();
     }
 
     public List<UserTO> searchByResource(final String realm, final String resource) {
-        return userService.search(
-                new AnySearchQuery.Builder().realm(realm).
-                fiql(SyncopeClient.getUserSearchConditionBuilder().hasResources(resource)
-                        .query()).build()).getResult();
+        return userService.search(new AnyQuery.Builder().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(
-                new AnySearchQuery.Builder().realm(realm).
-                fiql(SyncopeClient.getUserSearchConditionBuilder().is(attributeName).equalTo(attributeValue)
-                        .query()).build()).getResult();
+        return userService.search(new AnyQuery.Builder().realm(realm).
+                fiql(SyncopeClient.getUserSearchConditionBuilder().is(attributeName).equalTo(attributeValue).query()).
+                build()).getResult();
     }
 
     public PagedResult<UserTO> list() {
-        return userService.list(new AnyListQuery());
+        return userService.search(new AnyQuery());
     }
 
     public UserTO read(final String userKey) {
@@ -78,15 +72,14 @@ public class UserSyncopeOperations {
 
     public Map<String, BulkActionResult.Status> deleteByAttribute(
             final String realm, final String attributeName, final String attributeValue) {
-        final List<UserTO> users = userService.search(
-                new AnySearchQuery.Builder().realm(realm).
+        final List<UserTO> users = userService.search(new AnyQuery.Builder().realm(realm).
                 fiql(SyncopeClient.getUserSearchConditionBuilder().is(attributeName).equalTo(attributeValue)
                         .query()).build()).getResult();
         return deleteBulk(users);
     }
 
     public Map<String, BulkActionResult.Status> deleteAll(final String realm) {
-        return deleteBulk(userService.list(new AnyListQuery.Builder().realm(realm).details(false).build()).getResult());
+        return deleteBulk(userService.search(new AnyQuery.Builder().realm(realm).details(false).build()).getResult());
     }
 
     private Map<String, BulkActionResult.Status> deleteBulk(final List<UserTO> users) {

http://git-wip-us.apache.org/repos/asf/syncope/blob/649ba774/client/console/src/main/java/org/apache/syncope/client/console/commons/AnyDataProvider.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/commons/AnyDataProvider.java b/client/console/src/main/java/org/apache/syncope/client/console/commons/AnyDataProvider.java
index 1621eb4..20ac7ff 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/commons/AnyDataProvider.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/commons/AnyDataProvider.java
@@ -87,7 +87,7 @@ public class AnyDataProvider<A extends AnyTO> extends DirectoryDataProvider<A> {
                     ? Collections.<A>emptyList()
                     : restClient.search(realm, fiql, (page < 0 ? 0 : page) + 1, paginatorRows, getSort(), type);
         } else {
-            result = restClient.list(realm, (page < 0 ? 0 : page) + 1, paginatorRows, getSort(), type);
+            result = restClient.search(realm, null, (page < 0 ? 0 : page) + 1, paginatorRows, getSort(), type);
         }
 
         Collections.sort(result, comparator);
@@ -101,7 +101,7 @@ public class AnyDataProvider<A extends AnyTO> extends DirectoryDataProvider<A> {
         if (filtered) {
             result = fiql == null ? 0 : restClient.searchCount(realm, fiql, type);
         } else {
-            result = restClient.count(realm, type);
+            result = restClient.searchCount(realm, null, type);
         }
 
         return result;

http://git-wip-us.apache.org/repos/asf/syncope/blob/649ba774/client/console/src/main/java/org/apache/syncope/client/console/panels/search/AnyObjectSearchPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/search/AnyObjectSearchPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/search/AnyObjectSearchPanel.java
index f67e32b..caa3f8a 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/search/AnyObjectSearchPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/search/AnyObjectSearchPanel.java
@@ -80,7 +80,7 @@ public class AnyObjectSearchPanel extends AbstractSearchPanel {
 
             @Override
             protected Map<String, String> load() {
-                List<GroupTO> groupTOs = groupRestClient.list("/", -1, -1, new SortParam<>("name", true), null);
+                List<GroupTO> groupTOs = groupRestClient.search("/", null, -1, -1, new SortParam<>("name", true), null);
 
                 final Map<String, String> result = new HashMap<>(groupTOs.size());
                 for (GroupTO group : groupTOs) {

http://git-wip-us.apache.org/repos/asf/syncope/blob/649ba774/client/console/src/main/java/org/apache/syncope/client/console/rest/AbstractAnyRestClient.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/rest/AbstractAnyRestClient.java b/client/console/src/main/java/org/apache/syncope/client/console/rest/AbstractAnyRestClient.java
index e0ea1eb..b287029 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/rest/AbstractAnyRestClient.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/rest/AbstractAnyRestClient.java
@@ -43,14 +43,9 @@ public abstract class AbstractAnyRestClient<TO extends AnyTO, P extends AnyPatch
 
     protected abstract Class<? extends AnyService<TO, P>> getAnyServiceClass();
 
-    public abstract int count(String realm, String type);
-
-    public abstract List<TO> list(String realm, int page, int size, SortParam<String> sort, String type);
-
     public abstract int searchCount(String realm, String fiql, String type);
 
-    public abstract List<TO> search(
-            String realm, String fiql, int page, int size, SortParam<String> sort, String type);
+    public abstract List<TO> search(String realm, String fiql, int page, int size, SortParam<String> sort, String type);
 
     public TO read(final String key) {
         return getService(getAnyServiceClass()).read(key);

http://git-wip-us.apache.org/repos/asf/syncope/blob/649ba774/client/console/src/main/java/org/apache/syncope/client/console/rest/AnyObjectRestClient.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/rest/AnyObjectRestClient.java b/client/console/src/main/java/org/apache/syncope/client/console/rest/AnyObjectRestClient.java
index 2b91a8d..4e6092c 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/rest/AnyObjectRestClient.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/rest/AnyObjectRestClient.java
@@ -21,9 +21,7 @@ package org.apache.syncope.client.console.rest;
 import java.util.List;
 import org.apache.syncope.common.lib.patch.AnyObjectPatch;
 import org.apache.syncope.common.lib.to.AnyObjectTO;
-import org.apache.syncope.common.lib.to.PagedResult;
-import org.apache.syncope.common.rest.api.beans.AnyListQuery;
-import org.apache.syncope.common.rest.api.beans.AnySearchQuery;
+import org.apache.syncope.common.rest.api.beans.AnyQuery;
 import org.apache.syncope.common.rest.api.service.AnyObjectService;
 import org.apache.syncope.common.rest.api.service.AnyService;
 import org.apache.wicket.extensions.markup.html.repeater.util.SortParam;
@@ -41,27 +39,9 @@ public class AnyObjectRestClient extends AbstractAnyRestClient<AnyObjectTO, AnyO
     }
 
     @Override
-    public int count(final String realm, final String type) {
-        return getService(AnyObjectService.class).list(
-                type, new AnyListQuery.Builder().realm(realm).page(1).size(1).build()).getTotalCount();
-    }
-
-    @Override
-    public List<AnyObjectTO> list(
-            final String realm, final int page, final int size, final SortParam<String> sort, final String type) {
-
-        return list(type, realm).getResult();
-    }
-
-    public PagedResult<AnyObjectTO> list(final String type, final String realm) {
-        return getService(AnyObjectService.class).
-                list(type, new AnyListQuery.Builder().realm(realm).build());
-    }
-
-    @Override
     public int searchCount(final String realm, final String fiql, final String type) {
         return getService(AnyObjectService.class).
-                search(new AnySearchQuery.Builder().realm(realm).fiql(fiql).page(1).size(1).build()).
+                search(new AnyQuery.Builder().realm(realm).fiql(fiql).page(1).size(1).build()).
                 getTotalCount();
     }
 
@@ -71,7 +51,7 @@ public class AnyObjectRestClient extends AbstractAnyRestClient<AnyObjectTO, AnyO
             final String type) {
 
         return getService(AnyObjectService.class).search(
-                new AnySearchQuery.Builder().realm(realm).fiql(fiql).page(page).size(size).
+                new AnyQuery.Builder().realm(realm).fiql(fiql).page(page).size(size).
                 orderBy(toOrderBy(sort)).details(false).build()).getResult();
     }
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/649ba774/client/console/src/main/java/org/apache/syncope/client/console/rest/GroupRestClient.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/rest/GroupRestClient.java b/client/console/src/main/java/org/apache/syncope/client/console/rest/GroupRestClient.java
index 7b45005..36b2845 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/rest/GroupRestClient.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/rest/GroupRestClient.java
@@ -22,8 +22,7 @@ import java.util.List;
 import org.apache.syncope.common.lib.patch.GroupPatch;
 import org.apache.syncope.common.lib.to.GroupTO;
 import org.apache.syncope.common.lib.types.BulkMembersActionType;
-import org.apache.syncope.common.rest.api.beans.AnyListQuery;
-import org.apache.syncope.common.rest.api.beans.AnySearchQuery;
+import org.apache.syncope.common.rest.api.beans.AnyQuery;
 import org.apache.syncope.common.rest.api.service.AnyService;
 import org.apache.syncope.common.rest.api.service.GroupService;
 import org.apache.wicket.extensions.markup.html.repeater.util.SortParam;
@@ -41,26 +40,9 @@ public class GroupRestClient extends AbstractAnyRestClient<GroupTO, GroupPatch>
     }
 
     @Override
-    public int count(final String realm, final String type) {
-        return getService(GroupService.class).
-                list(new AnyListQuery.Builder().realm(realm).page(1).size(1).build()).
-                getTotalCount();
-    }
-
-    @Override
-    public List<GroupTO> list(
-            final String realm, final int page, final int size, final SortParam<String> sort, final String type) {
-
-        return getService(GroupService.class).
-                list(new AnyListQuery.Builder().realm(realm).page(page).size(size).
-                        orderBy(toOrderBy(sort)).details(false).build()).
-                getResult();
-    }
-
-    @Override
     public int searchCount(final String realm, final String fiql, final String type) {
         return getService(GroupService.class).
-                search(new AnySearchQuery.Builder().realm(realm).fiql(fiql).page(1).size(1).build()).
+                search(new AnyQuery.Builder().realm(realm).fiql(fiql).page(1).size(1).build()).
                 getTotalCount();
     }
 
@@ -70,7 +52,7 @@ public class GroupRestClient extends AbstractAnyRestClient<GroupTO, GroupPatch>
             final String type) {
 
         return getService(GroupService.class).
-                search(new AnySearchQuery.Builder().realm(realm).fiql(fiql).page(page).size(size).
+                search(new AnyQuery.Builder().realm(realm).fiql(fiql).page(page).size(size).
                         orderBy(toOrderBy(sort)).details(false).build()).
                 getResult();
     }

http://git-wip-us.apache.org/repos/asf/syncope/blob/649ba774/client/console/src/main/java/org/apache/syncope/client/console/rest/UserRestClient.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/rest/UserRestClient.java b/client/console/src/main/java/org/apache/syncope/client/console/rest/UserRestClient.java
index 7ea8d68..7a4e559 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/rest/UserRestClient.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/rest/UserRestClient.java
@@ -29,8 +29,7 @@ import org.apache.syncope.common.lib.patch.UserPatch;
 import org.apache.syncope.common.lib.to.ProvisioningResult;
 import org.apache.syncope.common.lib.to.UserTO;
 import org.apache.syncope.common.lib.types.StatusPatchType;
-import org.apache.syncope.common.rest.api.beans.AnyListQuery;
-import org.apache.syncope.common.rest.api.beans.AnySearchQuery;
+import org.apache.syncope.common.rest.api.beans.AnyQuery;
 import org.apache.syncope.common.rest.api.service.AnyService;
 import org.apache.syncope.common.rest.api.service.UserService;
 import org.apache.wicket.extensions.markup.html.repeater.util.SortParam;
@@ -54,25 +53,9 @@ public class UserRestClient extends AbstractAnyRestClient<UserTO, UserPatch> {
     }
 
     @Override
-    public int count(final String realm, final String type) {
-        return getService(UserService.class).
-                list(new AnyListQuery.Builder().realm(realm).page(1).size(1).build()).
-                getTotalCount();
-    }
-
-    @Override
-    public List<UserTO> list(
-            final String realm, final int page, final int size, final SortParam<String> sort, final String type) {
-
-        return getService(UserService.class).
-                list(new AnyListQuery.Builder().realm(realm).page(page).size(size).
-                        orderBy(toOrderBy(sort)).details(false).build()).getResult();
-    }
-
-    @Override
     public int searchCount(final String realm, final String fiql, final String type) {
         return getService(UserService.class).
-                search(new AnySearchQuery.Builder().realm(realm).fiql(fiql).page(1).size(1).build()).
+                search(new AnyQuery.Builder().realm(realm).fiql(fiql).page(1).size(1).build()).
                 getTotalCount();
     }
 
@@ -82,7 +65,7 @@ public class UserRestClient extends AbstractAnyRestClient<UserTO, UserPatch> {
             final String type) {
 
         return getService(UserService.class).
-                search(new AnySearchQuery.Builder().realm(realm).fiql(fiql).page(page).size(size).
+                search(new AnyQuery.Builder().realm(realm).fiql(fiql).page(page).size(size).
                         orderBy(toOrderBy(sort)).details(false).build()).getResult();
     }
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/649ba774/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/Groups.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/Groups.java b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/Groups.java
index 8935ef3..5131ce6 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/Groups.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/Groups.java
@@ -111,7 +111,8 @@ public class Groups extends WizardStep {
             }
         }).hideLabel().setOutputMarkupId(true));
 
-        List<GroupTO> allGroups = groupRestClient.list(anyTO.getRealm(), -1, -1, new SortParam<>("name", true), null);
+        List<GroupTO> allGroups = groupRestClient.search(
+                anyTO.getRealm(), null, -1, -1, new SortParam<>("name", true), null);
         final Map<String, GroupTO> allGroupsByKey = new LinkedHashMap<>(allGroups.size());
         for (GroupTO group : allGroups) {
             allGroupsByKey.put(group.getKey(), group);

http://git-wip-us.apache.org/repos/asf/syncope/blob/649ba774/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/SyncopeGroupResource.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/SyncopeGroupResource.java b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/SyncopeGroupResource.java
index 09e3b85..7757532 100644
--- a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/SyncopeGroupResource.java
+++ b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/SyncopeGroupResource.java
@@ -25,18 +25,14 @@ import javax.ws.rs.core.Response;
 import org.apache.syncope.client.enduser.SyncopeEnduserSession;
 import org.apache.syncope.common.lib.SyncopeConstants;
 import org.apache.syncope.common.lib.to.GroupTO;
-import org.apache.syncope.common.rest.api.beans.AnyListQuery;
+import org.apache.syncope.common.rest.api.beans.AnyQuery;
 import org.apache.syncope.common.rest.api.service.GroupService;
 import org.apache.wicket.request.resource.AbstractResource;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 public class SyncopeGroupResource extends AbstractBaseResource {
 
     private static final long serialVersionUID = 7475706378304995200L;
 
-    private static final Logger LOG = LoggerFactory.getLogger(SyncopeGroupResource.class);
-
     private final GroupService groupService;
 
     public SyncopeGroupResource() {
@@ -61,7 +57,7 @@ public class SyncopeGroupResource extends AbstractBaseResource {
 
             String realm = java.net.URLDecoder.decode(attributes.getParameters().get("realm").toString(
                     SyncopeConstants.ROOT_REALM), "UTF-8");
-            final List<GroupTO> groupTOs = groupService.list(new AnyListQuery.Builder().realm(realm).build()).
+            final List<GroupTO> groupTOs = groupService.search(new AnyQuery.Builder().realm(realm).build()).
                     getResult();
 
             response.setWriteCallback(new AbstractResource.WriteCallback() {

http://git-wip-us.apache.org/repos/asf/syncope/blob/649ba774/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/AnyListQuery.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/AnyListQuery.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/AnyListQuery.java
deleted file mode 100644
index cc394c0..0000000
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/AnyListQuery.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.common.rest.api.beans;
-
-import javax.ws.rs.DefaultValue;
-import javax.ws.rs.MatrixParam;
-import org.apache.syncope.common.lib.SyncopeConstants;
-
-public class AnyListQuery extends AnyQuery {
-
-    private static final long serialVersionUID = -5197167078435619636L;
-
-    public static class Builder extends AbstractQuery.Builder<AnyListQuery, Builder> {
-
-        @Override
-        protected AnyListQuery newInstance() {
-            return new AnyListQuery();
-        }
-
-        public Builder details(final boolean details) {
-            getInstance().setDetails(details);
-            return this;
-        }
-
-        public Builder realm(final String realm) {
-            getInstance().setRealm(realm);
-            return this;
-        }
-    }
-
-    private String realm;
-
-    public String getRealm() {
-        return realm;
-    }
-
-    @DefaultValue(SyncopeConstants.ROOT_REALM)
-    @MatrixParam("realm")
-    public void setRealm(final String realm) {
-        this.realm = realm;
-    }
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/649ba774/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/AnyQuery.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/AnyQuery.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/AnyQuery.java
index 4763b13..5b5b79c 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/AnyQuery.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/AnyQuery.java
@@ -19,12 +19,14 @@
 package org.apache.syncope.common.rest.api.beans;
 
 import javax.ws.rs.DefaultValue;
+import javax.ws.rs.MatrixParam;
 import javax.ws.rs.QueryParam;
+import org.apache.syncope.common.lib.SyncopeConstants;
 import org.apache.syncope.common.rest.api.service.JAXRSService;
 
 public class AnyQuery extends AbstractQuery {
 
-    private static final long serialVersionUID = -371488230250055359L;
+    private static final long serialVersionUID = -6736562952418964707L;
 
     public static class Builder extends AbstractQuery.Builder<AnyQuery, Builder> {
 
@@ -38,10 +40,34 @@ public class AnyQuery extends AbstractQuery {
             return this;
         }
 
+        public Builder realm(final String realm) {
+            getInstance().setRealm(realm);
+            return this;
+        }
+
+        public Builder fiql(final String fiql) {
+            getInstance().setFiql(fiql);
+
+            return this;
+        }
     }
 
+    private String realm;
+
     private Boolean details;
 
+    private String fiql;
+
+    public String getRealm() {
+        return realm;
+    }
+
+    @DefaultValue(SyncopeConstants.ROOT_REALM)
+    @MatrixParam("realm")
+    public void setRealm(final String realm) {
+        this.realm = realm;
+    }
+
     public Boolean getDetails() {
         return details == null ? true : details;
     }
@@ -51,4 +77,14 @@ public class AnyQuery extends AbstractQuery {
     public void setDetails(final Boolean details) {
         this.details = details;
     }
+
+    public String getFiql() {
+        return fiql;
+    }
+
+    @QueryParam(JAXRSService.PARAM_FIQL)
+    public void setFiql(final String fiql) {
+        this.fiql = fiql;
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/649ba774/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/AnySearchQuery.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/AnySearchQuery.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/AnySearchQuery.java
deleted file mode 100644
index ae38801..0000000
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/AnySearchQuery.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.common.rest.api.beans;
-
-import javax.ws.rs.QueryParam;
-import org.apache.syncope.common.rest.api.service.JAXRSService;
-
-public class AnySearchQuery extends AnyListQuery {
-
-    private static final long serialVersionUID = -6736562952418964707L;
-
-    public static class Builder extends AbstractQuery.Builder<AnySearchQuery, Builder> {
-
-        @Override
-        protected AnySearchQuery newInstance() {
-            return new AnySearchQuery();
-        }
-
-        public Builder details(final boolean details) {
-            getInstance().setDetails(details);
-            return this;
-        }
-
-        public Builder realm(final String realm) {
-            getInstance().setRealm(realm);
-            return this;
-        }
-
-        public Builder fiql(final String fiql) {
-            getInstance().setFiql(fiql);
-
-            return this;
-        }
-    }
-
-    private String fiql;
-
-    public String getFiql() {
-        return fiql;
-    }
-
-    @QueryParam(JAXRSService.PARAM_FIQL)
-    public void setFiql(final String fiql) {
-        this.fiql = fiql;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/649ba774/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyObjectService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyObjectService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyObjectService.java
index eaa6439..4127345 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyObjectService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyObjectService.java
@@ -18,33 +18,13 @@
  */
 package org.apache.syncope.common.rest.api.service;
 
-import javax.validation.constraints.NotNull;
-import javax.ws.rs.BeanParam;
-import javax.ws.rs.GET;
-import javax.ws.rs.MatrixParam;
 import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
 import org.apache.syncope.common.lib.patch.AnyObjectPatch;
 import org.apache.syncope.common.lib.to.AnyObjectTO;
-import org.apache.syncope.common.lib.to.PagedResult;
-import org.apache.syncope.common.rest.api.beans.AnyListQuery;
 
 /**
  * REST operations for anyObjects.
  */
 @Path("anyObjects")
 public interface AnyObjectService extends AnyService<AnyObjectTO, AnyObjectPatch> {
-
-    /**
-     * Returns a paged list of existing any objects matching the given query, for the given type.
-     *
-     * @param type any type
-     * @param listQuery query conditions
-     * @return paged list of existing any objects matching the given query, for the given type
-     */
-    @GET
-    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
-    PagedResult<AnyObjectTO> list(@NotNull @MatrixParam("type") String type, @BeanParam AnyListQuery listQuery);
-
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/649ba774/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyService.java
index 16542f3..ac958e1 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyService.java
@@ -40,7 +40,7 @@ import org.apache.syncope.common.lib.to.AttrTO;
 import org.apache.syncope.common.lib.to.BulkAction;
 import org.apache.syncope.common.lib.to.PagedResult;
 import org.apache.syncope.common.lib.types.SchemaType;
-import org.apache.syncope.common.rest.api.beans.AnySearchQuery;
+import org.apache.syncope.common.rest.api.beans.AnyQuery;
 
 public interface AnyService<TO extends AnyTO, P extends AnyPatch> extends JAXRSService {
 
@@ -86,13 +86,12 @@ public interface AnyService<TO extends AnyTO, P extends AnyPatch> extends JAXRSS
     /**
      * Returns a paged list of any objects matching the given query.
      *
-     * @param searchQuery query conditions
+     * @param anyQuery query conditions
      * @return paged list of any objects matching the given query
      */
     @GET
-    @Path("search")
     @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
-    PagedResult<TO> search(@BeanParam AnySearchQuery searchQuery);
+    PagedResult<TO> search(@BeanParam AnyQuery anyQuery);
 
     /**
      * Creates a new any object.

http://git-wip-us.apache.org/repos/asf/syncope/blob/649ba774/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/GroupService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/GroupService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/GroupService.java
index cc0d677..549b41a 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/GroupService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/GroupService.java
@@ -20,7 +20,6 @@ package org.apache.syncope.common.rest.api.service;
 
 import java.util.List;
 import javax.validation.constraints.NotNull;
-import javax.ws.rs.BeanParam;
 import javax.ws.rs.GET;
 import javax.ws.rs.POST;
 import javax.ws.rs.Path;
@@ -30,9 +29,7 @@ import javax.ws.rs.core.MediaType;
 import org.apache.syncope.common.lib.patch.GroupPatch;
 import org.apache.syncope.common.lib.to.ExecTO;
 import org.apache.syncope.common.lib.to.GroupTO;
-import org.apache.syncope.common.lib.to.PagedResult;
 import org.apache.syncope.common.lib.types.BulkMembersActionType;
-import org.apache.syncope.common.rest.api.beans.AnyListQuery;
 
 /**
  * REST operations for groups.
@@ -52,16 +49,6 @@ public interface GroupService extends AnyService<GroupTO, GroupPatch> {
     List<GroupTO> own();
 
     /**
-     * Returns a paged list of existing groups matching the given query.
-     *
-     * @param listQuery query conditions
-     * @return paged list of existing groups matching the given query
-     */
-    @GET
-    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
-    PagedResult<GroupTO> list(@BeanParam AnyListQuery listQuery);
-
-    /**
      * (De)provision all members of the given group from / onto all the resources associated to it.
      *
      * @param key group key

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

http://git-wip-us.apache.org/repos/asf/syncope/blob/649ba774/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/AbstractAnyService.java
----------------------------------------------------------------------
diff --git a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/AbstractAnyService.java b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/AbstractAnyService.java
index 3e42a3c..d24f522 100644
--- a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/AbstractAnyService.java
+++ b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/AbstractAnyService.java
@@ -44,8 +44,7 @@ import org.apache.syncope.common.lib.types.ResourceAssociationAction;
 import org.apache.syncope.common.lib.types.ResourceDeassociationAction;
 import org.apache.syncope.common.lib.types.SchemaType;
 import org.apache.syncope.common.lib.types.StatusPatchType;
-import org.apache.syncope.common.rest.api.beans.AnyListQuery;
-import org.apache.syncope.common.rest.api.beans.AnySearchQuery;
+import org.apache.syncope.common.rest.api.beans.AnyQuery;
 import org.apache.syncope.common.rest.api.service.AnyService;
 import org.apache.syncope.core.logic.AbstractAnyLogic;
 import org.apache.syncope.core.logic.UserLogic;
@@ -111,42 +110,38 @@ public abstract class AbstractAnyService<TO extends AnyTO, P extends AnyPatch>
         return getAnyLogic().read(key);
     }
 
-    protected PagedResult<TO> list(final AnyListQuery listQuery) {
-        String realm = StringUtils.prependIfMissing(listQuery.getRealm(), SyncopeConstants.ROOT_REALM);
-
-        return buildPagedResult(
-                getAnyLogic().list(
-                        listQuery.getPage(),
-                        listQuery.getSize(),
-                        getOrderByClauses(listQuery.getOrderBy()),
-                        realm,
-                        listQuery.getDetails()),
-                listQuery.getPage(),
-                listQuery.getSize(),
-                getAnyLogic().count(realm));
-    }
-
     @Override
-    public PagedResult<TO> search(final AnySearchQuery searchQuery) {
-        String realm = StringUtils.prependIfMissing(searchQuery.getRealm(), SyncopeConstants.ROOT_REALM);
-
-        // if an assignable query is provided in the FIQL string, start anyway from root realm
-        boolean isAssignableCond = searchQuery.getFiql() == null
-                ? false
-                : -1 != searchQuery.getFiql().indexOf(SpecialAttr.ASSIGNABLE.toString());
-
-        SearchCond cond = getSearchCond(searchQuery.getFiql(), realm);
-        return buildPagedResult(
-                getAnyLogic().search(
-                        cond,
-                        searchQuery.getPage(),
-                        searchQuery.getSize(),
-                        getOrderByClauses(searchQuery.getOrderBy()),
-                        isAssignableCond ? SyncopeConstants.ROOT_REALM : realm,
-                        searchQuery.getDetails()),
-                searchQuery.getPage(),
-                searchQuery.getSize(),
-                getAnyLogic().searchCount(cond, isAssignableCond ? SyncopeConstants.ROOT_REALM : realm));
+    public PagedResult<TO> search(final AnyQuery anyQuery) {
+        String realm = StringUtils.prependIfMissing(anyQuery.getRealm(), SyncopeConstants.ROOT_REALM);
+
+        if (StringUtils.isBlank(anyQuery.getFiql())) {
+            return buildPagedResult(
+                    getAnyLogic().list(
+                            anyQuery.getPage(),
+                            anyQuery.getSize(),
+                            getOrderByClauses(anyQuery.getOrderBy()),
+                            realm,
+                            anyQuery.getDetails()),
+                    anyQuery.getPage(),
+                    anyQuery.getSize(),
+                    getAnyLogic().count(realm));
+        } else {
+            // if an assignable query is provided in the FIQL string, start anyway from root realm
+            boolean isAssignableCond = -1 != anyQuery.getFiql().indexOf(SpecialAttr.ASSIGNABLE.toString());
+
+            SearchCond cond = getSearchCond(anyQuery.getFiql(), realm);
+            return buildPagedResult(
+                    getAnyLogic().search(
+                            cond,
+                            anyQuery.getPage(),
+                            anyQuery.getSize(),
+                            getOrderByClauses(anyQuery.getOrderBy()),
+                            isAssignableCond ? SyncopeConstants.ROOT_REALM : realm,
+                            anyQuery.getDetails()),
+                    anyQuery.getPage(),
+                    anyQuery.getSize(),
+                    getAnyLogic().searchCount(cond, isAssignableCond ? SyncopeConstants.ROOT_REALM : realm));
+        }
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/syncope/blob/649ba774/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/AnyObjectServiceImpl.java
----------------------------------------------------------------------
diff --git a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/AnyObjectServiceImpl.java b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/AnyObjectServiceImpl.java
index 37ee9cd..c5ae33e 100644
--- a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/AnyObjectServiceImpl.java
+++ b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/AnyObjectServiceImpl.java
@@ -18,17 +18,16 @@
  */
 package org.apache.syncope.core.rest.cxf.service;
 
+import javax.ws.rs.BadRequestException;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.syncope.common.lib.patch.AnyObjectPatch;
-import org.apache.syncope.common.lib.search.AnyObjectFiqlSearchConditionBuilder;
+import org.apache.syncope.common.lib.search.SpecialAttr;
 import org.apache.syncope.common.lib.to.AnyObjectTO;
 import org.apache.syncope.common.lib.to.PagedResult;
-import org.apache.syncope.common.rest.api.beans.AnyListQuery;
-import org.apache.syncope.common.rest.api.beans.AnySearchQuery;
+import org.apache.syncope.common.rest.api.beans.AnyQuery;
 import org.apache.syncope.common.rest.api.service.AnyObjectService;
 import org.apache.syncope.core.logic.AbstractAnyLogic;
 import org.apache.syncope.core.logic.AnyObjectLogic;
-import org.apache.syncope.core.persistence.api.entity.AnyType;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -51,25 +50,14 @@ public class AnyObjectServiceImpl extends AbstractAnyService<AnyObjectTO, AnyObj
     }
 
     @Override
-    public PagedResult<AnyObjectTO> list(final AnyListQuery listQuery) {
-        throw new UnsupportedOperationException("Need to specify " + AnyType.class.getSimpleName());
-    }
+    public PagedResult<AnyObjectTO> search(final AnyQuery anyQuery) {
+        if (StringUtils.isBlank(anyQuery.getFiql())
+                || -1 == anyQuery.getFiql().indexOf(SpecialAttr.TYPE.toString())) {
 
-    @Override
-    public PagedResult<AnyObjectTO> list(final String type, final AnyListQuery listQuery) {
-        if (StringUtils.isBlank(type)) {
-            return super.list(listQuery);
+            throw new BadRequestException(SpecialAttr.TYPE.toString() + " is required in the FIQL string");
         }
 
-        AnySearchQuery searchQuery = new AnySearchQuery();
-        searchQuery.setFiql(new AnyObjectFiqlSearchConditionBuilder(type).query());
-        searchQuery.setDetails(listQuery.getDetails());
-        searchQuery.setOrderBy(listQuery.getOrderBy());
-        searchQuery.setPage(listQuery.getPage());
-        searchQuery.setSize(listQuery.getSize());
-        searchQuery.setRealm(listQuery.getRealm());
-
-        return search(searchQuery);
+        return super.search(anyQuery);
     }
 
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/649ba774/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/GroupServiceImpl.java
----------------------------------------------------------------------
diff --git a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/GroupServiceImpl.java b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/GroupServiceImpl.java
index f19b6fa..50ef081 100644
--- a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/GroupServiceImpl.java
+++ b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/GroupServiceImpl.java
@@ -22,9 +22,7 @@ import java.util.List;
 import org.apache.syncope.common.lib.patch.GroupPatch;
 import org.apache.syncope.common.lib.to.ExecTO;
 import org.apache.syncope.common.lib.to.GroupTO;
-import org.apache.syncope.common.lib.to.PagedResult;
 import org.apache.syncope.common.lib.types.BulkMembersActionType;
-import org.apache.syncope.common.rest.api.beans.AnyListQuery;
 import org.apache.syncope.common.rest.api.service.GroupService;
 import org.apache.syncope.core.logic.AbstractAnyLogic;
 import org.apache.syncope.core.logic.GroupLogic;
@@ -55,11 +53,6 @@ public class GroupServiceImpl extends AbstractAnyService<GroupTO, GroupPatch> im
     }
 
     @Override
-    public PagedResult<GroupTO> list(final AnyListQuery listQuery) {
-        return super.list(listQuery);
-    }
-
-    @Override
     public ExecTO bulkMembersAction(final String key, final BulkMembersActionType actionType) {
         return logic.bulkMembersAction(key, actionType);
     }

http://git-wip-us.apache.org/repos/asf/syncope/blob/649ba774/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/UserServiceImpl.java
----------------------------------------------------------------------
diff --git a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/UserServiceImpl.java b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/UserServiceImpl.java
index f395c59..fe33390 100644
--- a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/UserServiceImpl.java
+++ b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/UserServiceImpl.java
@@ -21,10 +21,8 @@ package org.apache.syncope.core.rest.cxf.service;
 import javax.ws.rs.core.Response;
 import org.apache.syncope.common.lib.patch.StatusPatch;
 import org.apache.syncope.common.lib.patch.UserPatch;
-import org.apache.syncope.common.lib.to.PagedResult;
 import org.apache.syncope.common.lib.to.ProvisioningResult;
 import org.apache.syncope.common.lib.to.UserTO;
-import org.apache.syncope.common.rest.api.beans.AnyListQuery;
 import org.apache.syncope.common.rest.api.service.UserService;
 import org.apache.syncope.core.logic.AbstractAnyLogic;
 import org.apache.syncope.core.logic.UserLogic;
@@ -50,11 +48,6 @@ public class UserServiceImpl extends AbstractAnyService<UserTO, UserPatch> imple
     }
 
     @Override
-    public PagedResult<UserTO> list(final AnyListQuery listQuery) {
-        return super.list(listQuery);
-    }
-
-    @Override
     public Response create(final UserTO userTO, final boolean storePassword) {
         ProvisioningResult<UserTO> created = logic.create(userTO, storePassword, isNullPriorityAsync());
         return createResponse(created);

http://git-wip-us.apache.org/repos/asf/syncope/blob/649ba774/fit/core-reference/src/test/java/org/apache/syncope/fit/core/AnyObjectITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/AnyObjectITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/AnyObjectITCase.java
index 7356c5c..3e9c98d 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/AnyObjectITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/AnyObjectITCase.java
@@ -27,6 +27,7 @@ import static org.junit.Assert.fail;
 import java.util.Set;
 import java.util.UUID;
 import javax.ws.rs.core.Response;
+import org.apache.syncope.client.lib.SyncopeClient;
 import org.apache.syncope.common.lib.SyncopeClientException;
 import org.apache.syncope.common.lib.SyncopeConstants;
 import org.apache.syncope.common.lib.patch.AnyObjectPatch;
@@ -39,7 +40,7 @@ import org.apache.syncope.common.lib.to.RelationshipTO;
 import org.apache.syncope.common.lib.types.AnyTypeKind;
 import org.apache.syncope.common.lib.types.ClientExceptionType;
 import org.apache.syncope.common.lib.types.SchemaType;
-import org.apache.syncope.common.rest.api.beans.AnyListQuery;
+import org.apache.syncope.common.rest.api.beans.AnyQuery;
 import org.apache.syncope.fit.AbstractITCase;
 import org.junit.FixMethodOrder;
 import org.junit.Test;
@@ -123,8 +124,10 @@ public class AnyObjectITCase extends AbstractITCase {
 
     @Test
     public void list() {
-        PagedResult<AnyObjectTO> anyObjectTOs = anyObjectService.list(
-                "PRINTER", new AnyListQuery.Builder().realm(SyncopeConstants.ROOT_REALM).build());
+        PagedResult<AnyObjectTO> anyObjectTOs = anyObjectService.search(
+                new AnyQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
+                fiql(SyncopeClient.getAnyObjectSearchConditionBuilder("PRINTER").query()).
+                build());
         assertNotNull(anyObjectTOs);
         assertTrue(anyObjectTOs.getResult().size() >= 2);
         for (AnyObjectTO anyObjectTO : anyObjectTOs.getResult()) {

http://git-wip-us.apache.org/repos/asf/syncope/blob/649ba774/fit/core-reference/src/test/java/org/apache/syncope/fit/core/AuthenticationITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/AuthenticationITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/AuthenticationITCase.java
index 05d9898..864c582 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/AuthenticationITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/AuthenticationITCase.java
@@ -68,7 +68,7 @@ import org.apache.syncope.common.lib.types.SchemaType;
 import org.apache.syncope.common.lib.types.StandardEntitlement;
 import org.apache.syncope.common.lib.types.StatusPatchType;
 import org.apache.syncope.common.rest.api.RESTHeaders;
-import org.apache.syncope.common.rest.api.beans.AnySearchQuery;
+import org.apache.syncope.common.rest.api.beans.AnyQuery;
 import org.apache.syncope.common.rest.api.service.AnyObjectService;
 import org.apache.syncope.common.rest.api.service.SchemaService;
 import org.apache.syncope.common.rest.api.service.UserService;
@@ -206,8 +206,7 @@ public class AuthenticationITCase extends AbstractITCase {
         UserService userService2 = clientFactory.create(userTO.getUsername(), "password123").
                 getService(UserService.class);
 
-        PagedResult<UserTO> matchingUsers = userService2.search(
-                new AnySearchQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
+        PagedResult<UserTO> matchingUsers = userService2.search(new AnyQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
                 fiql(SyncopeClient.getUserSearchConditionBuilder().isNotNull("key").query()).build());
         assertNotNull(matchingUsers);
         assertFalse(matchingUsers.getResult().isEmpty());
@@ -220,8 +219,7 @@ public class AuthenticationITCase extends AbstractITCase {
         // 2. user assigned to role 4, with search entitlement on realm /even/two
         UserService userService3 = clientFactory.create("puccini", ADMIN_PWD).getService(UserService.class);
 
-        matchingUsers = userService3.search(
-                new AnySearchQuery.Builder().realm("/even/two").
+        matchingUsers = userService3.search(new AnyQuery.Builder().realm("/even/two").
                 fiql(SyncopeClient.getUserSearchConditionBuilder().isNotNull("loginDate").query()).build());
         assertNotNull(matchingUsers);
         assertTrue(IterableUtils.matchesAll(matchingUsers.getResult(), new Predicate<UserTO>() {

http://git-wip-us.apache.org/repos/asf/syncope/blob/649ba774/fit/core-reference/src/test/java/org/apache/syncope/fit/core/GroupITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/GroupITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/GroupITCase.java
index 2162b42..f870b45 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/GroupITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/GroupITCase.java
@@ -84,8 +84,7 @@ import org.apache.syncope.common.lib.types.PropagationTaskExecStatus;
 import org.apache.syncope.common.lib.types.ResourceAssociationAction;
 import org.apache.syncope.common.lib.types.ResourceDeassociationAction;
 import org.apache.syncope.common.lib.types.SchemaType;
-import org.apache.syncope.common.rest.api.beans.AnyListQuery;
-import org.apache.syncope.common.rest.api.beans.AnySearchQuery;
+import org.apache.syncope.common.rest.api.beans.AnyQuery;
 import org.apache.syncope.common.rest.api.service.GroupService;
 import org.apache.syncope.core.provisioning.java.job.TaskJob;
 import org.apache.syncope.fit.AbstractITCase;
@@ -171,7 +170,7 @@ public class GroupITCase extends AbstractITCase {
     @Test
     public void list() {
         PagedResult<GroupTO> groupTOs =
-                groupService.list(new AnyListQuery.Builder().realm(SyncopeConstants.ROOT_REALM).build());
+                groupService.search(new AnyQuery.Builder().realm(SyncopeConstants.ROOT_REALM).build());
         assertNotNull(groupTOs);
         assertTrue(groupTOs.getResult().size() >= 8);
         for (GroupTO groupTO : groupTOs.getResult()) {
@@ -615,14 +614,14 @@ public class GroupITCase extends AbstractITCase {
     public void anonymous() {
         GroupService unauthenticated = clientFactory.create().getService(GroupService.class);
         try {
-            unauthenticated.list(new AnySearchQuery.Builder().realm(SyncopeConstants.ROOT_REALM).build());
+            unauthenticated.search(new AnyQuery.Builder().realm(SyncopeConstants.ROOT_REALM).build());
             fail();
         } catch (AccessControlException e) {
             assertNotNull(e);
         }
 
         GroupService anonymous = clientFactory.create(ANONYMOUS_UNAME, ANONYMOUS_KEY).getService(GroupService.class);
-        assertFalse(anonymous.list(new AnySearchQuery.Builder().realm(SyncopeConstants.ROOT_REALM).build()).
+        assertFalse(anonymous.search(new AnyQuery.Builder().realm(SyncopeConstants.ROOT_REALM).build()).
                 getResult().isEmpty());
     }
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/649ba774/fit/core-reference/src/test/java/org/apache/syncope/fit/core/MembershipITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/MembershipITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/MembershipITCase.java
index 3d98f28..6b83e2a 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/MembershipITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/MembershipITCase.java
@@ -52,7 +52,7 @@ import org.apache.syncope.common.lib.types.MappingPurpose;
 import org.apache.syncope.common.lib.types.PatchOperation;
 import org.apache.syncope.common.lib.types.PropagationTaskExecStatus;
 import org.apache.syncope.common.lib.types.ResourceDeassociationAction;
-import org.apache.syncope.common.rest.api.beans.AnySearchQuery;
+import org.apache.syncope.common.rest.api.beans.AnyQuery;
 import org.apache.syncope.common.rest.api.service.TaskService;
 import org.apache.syncope.fit.AbstractITCase;
 import org.junit.FixMethodOrder;
@@ -297,7 +297,7 @@ public class MembershipITCase extends AbstractITCase {
             assertEquals(PropagationTaskExecStatus.SUCCESS, PropagationTaskExecStatus.valueOf(execution.getStatus()));
 
             // 5. verify that pulled user has
-            PagedResult<UserTO> users = userService.search(new AnySearchQuery.Builder().
+            PagedResult<UserTO> users = userService.search(new AnyQuery.Builder().
                     realm("/").
                     fiql(SyncopeClient.getUserSearchConditionBuilder().
                             is("username").equalTo(user.getUsername()).query()).build());

http://git-wip-us.apache.org/repos/asf/syncope/blob/649ba774/fit/core-reference/src/test/java/org/apache/syncope/fit/core/MultitenancyITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/MultitenancyITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/MultitenancyITCase.java
index 2c5b023..d0cc322 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/MultitenancyITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/MultitenancyITCase.java
@@ -49,7 +49,7 @@ import org.apache.syncope.common.lib.types.MappingPurpose;
 import org.apache.syncope.common.lib.types.PropagationTaskExecStatus;
 import org.apache.syncope.common.lib.types.SchemaType;
 import org.apache.syncope.common.lib.types.PullMode;
-import org.apache.syncope.common.rest.api.beans.AnySearchQuery;
+import org.apache.syncope.common.rest.api.beans.AnyQuery;
 import org.apache.syncope.common.rest.api.beans.SchemaQuery;
 import org.apache.syncope.common.rest.api.service.ConnectorService;
 import org.apache.syncope.common.rest.api.service.DomainService;
@@ -212,8 +212,7 @@ public class MultitenancyITCase extends AbstractITCase {
             assertEquals(PropagationTaskExecStatus.SUCCESS, PropagationTaskExecStatus.valueOf(status));
 
             // verify that pulled user is found
-            PagedResult<UserTO> matchingUsers = adminClient.getService(UserService.class).search(
-                    new AnySearchQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
+            PagedResult<UserTO> matchingUsers = adminClient.getService(UserService.class).search(new AnyQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
                     fiql(SyncopeClient.getUserSearchConditionBuilder().is("username").equalTo("pullFromLDAP").query()).
                     build());
             assertNotNull(matchingUsers);

http://git-wip-us.apache.org/repos/asf/syncope/blob/649ba774/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PullTaskITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PullTaskITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PullTaskITCase.java
index 30148e5..0f155c7 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PullTaskITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PullTaskITCase.java
@@ -66,7 +66,7 @@ import org.apache.syncope.common.lib.types.PropagationTaskExecStatus;
 import org.apache.syncope.common.lib.types.ResourceDeassociationAction;
 import org.apache.syncope.common.lib.types.PullMode;
 import org.apache.syncope.common.lib.types.TaskType;
-import org.apache.syncope.common.rest.api.beans.AnySearchQuery;
+import org.apache.syncope.common.rest.api.beans.AnyQuery;
 import org.apache.syncope.common.rest.api.beans.TaskQuery;
 import org.apache.syncope.common.rest.api.service.ConnectorService;
 import org.apache.syncope.common.rest.api.service.TaskService;
@@ -172,8 +172,7 @@ public class PullTaskITCase extends AbstractTaskITCase {
 
         // -----------------------------
         try {
-            int usersPre = userService.list(
-                    new AnySearchQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
+            int usersPre = userService.search(new AnyQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
                     page(1).size(1).build()).getTotalCount();
             assertNotNull(usersPre);
 
@@ -228,8 +227,7 @@ public class PullTaskITCase extends AbstractTaskITCase {
             }
 
             // check for pull results
-            int usersPost = userService.list(
-                    new AnySearchQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
+            int usersPost = userService.search(new AnyQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
                     page(1).size(1).build()).getTotalCount();
             assertNotNull(usersPost);
             assertEquals(usersPre + 8, usersPost);
@@ -303,8 +301,8 @@ public class PullTaskITCase extends AbstractTaskITCase {
      * Clean Syncope and LDAP resource status.
      */
     private void ldapCleanup() {
-        PagedResult<GroupTO> matchingGroups = groupService.search(
-                new AnySearchQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
+        PagedResult<GroupTO> matchingGroups = groupService.search(new AnyQuery.Builder().realm(
+                SyncopeConstants.ROOT_REALM).
                 fiql(SyncopeClient.getGroupSearchConditionBuilder().is("name").equalTo("testLDAPGroup").query()).
                 build());
         if (matchingGroups.getSize() > 0) {
@@ -318,7 +316,7 @@ public class PullTaskITCase extends AbstractTaskITCase {
             }
         }
         PagedResult<UserTO> matchingUsers = userService.search(
-                new AnySearchQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
+                new AnyQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
                 fiql(SyncopeClient.getUserSearchConditionBuilder().is("username").equalTo("pullFromLDAP").query()).
                 build());
         if (matchingUsers.getSize() > 0) {
@@ -345,8 +343,8 @@ public class PullTaskITCase extends AbstractTaskITCase {
         assertEquals(PropagationTaskExecStatus.SUCCESS, PropagationTaskExecStatus.valueOf(execution.getStatus()));
 
         // 2. verify that pulled group is found
-        PagedResult<GroupTO> matchingGroups = groupService.search(
-                new AnySearchQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
+        PagedResult<GroupTO> matchingGroups = groupService.search(new AnyQuery.Builder().realm(
+                SyncopeConstants.ROOT_REALM).
                 fiql(SyncopeClient.getGroupSearchConditionBuilder().is("name").equalTo("testLDAPGroup").query()).
                 build());
         assertNotNull(matchingGroups);
@@ -354,7 +352,7 @@ public class PullTaskITCase extends AbstractTaskITCase {
 
         // 3. verify that pulled user is found
         PagedResult<UserTO> matchingUsers = userService.search(
-                new AnySearchQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
+                new AnyQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
                 fiql(SyncopeClient.getUserSearchConditionBuilder().is("username").equalTo("pullFromLDAP").query()).
                 build());
         assertNotNull(matchingUsers);
@@ -379,8 +377,7 @@ public class PullTaskITCase extends AbstractTaskITCase {
         execProvisioningTask(taskService, "1e419ca4-ea81-4493-a14f-28b90113686d", 50, false);
 
         // 4. verify that LDAP group membership is propagated as Syncope membership
-        PagedResult<UserTO> members = userService.search(
-                new AnySearchQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
+        PagedResult<UserTO> members = userService.search(new AnyQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
                 fiql(SyncopeClient.getUserSearchConditionBuilder().inGroups(groupTO.getKey()).query()).
                 build());
         assertNotNull(members);
@@ -429,8 +426,8 @@ public class PullTaskITCase extends AbstractTaskITCase {
                     startsWith(PrefixMappingItemTransformer.PREFIX));
 
             // 3. unlink any existing printer and delete from Syncope (printer is now only on external resource)
-            PagedResult<AnyObjectTO> matchingPrinters = anyObjectService.search(
-                    new AnySearchQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
+            PagedResult<AnyObjectTO> matchingPrinters = anyObjectService.search(new AnyQuery.Builder().realm(
+                    SyncopeConstants.ROOT_REALM).
                     fiql(SyncopeClient.getAnyObjectSearchConditionBuilder("PRINTER").
                             is("location").equalTo("pull*").query()).build());
             assertTrue(matchingPrinters.getSize() > 0);
@@ -448,8 +445,7 @@ public class PullTaskITCase extends AbstractTaskITCase {
 
             // 5. verify that printer was re-created in Syncope (implies that location does not start with given prefix,
             // hence PrefixMappingItemTransformer was applied during pull)
-            matchingPrinters = anyObjectService.search(
-                    new AnySearchQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
+            matchingPrinters = anyObjectService.search(new AnyQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
                     fiql(SyncopeClient.getAnyObjectSearchConditionBuilder("PRINTER").
                             is("location").equalTo("pull*").query()).build());
             assertTrue(matchingPrinters.getSize() > 0);

http://git-wip-us.apache.org/repos/asf/syncope/blob/649ba774/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SearchITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SearchITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SearchITCase.java
index 8cdd7fb..eefcfb4 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SearchITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SearchITCase.java
@@ -35,7 +35,7 @@ import org.apache.syncope.common.lib.to.PagedResult;
 import org.apache.syncope.common.lib.to.GroupTO;
 import org.apache.syncope.common.lib.to.RoleTO;
 import org.apache.syncope.common.lib.to.UserTO;
-import org.apache.syncope.common.rest.api.beans.AnySearchQuery;
+import org.apache.syncope.common.rest.api.beans.AnyQuery;
 import org.apache.syncope.common.rest.api.service.RoleService;
 import org.apache.syncope.fit.AbstractITCase;
 import org.junit.FixMethodOrder;
@@ -48,8 +48,7 @@ public class SearchITCase extends AbstractITCase {
     @Test
     public void searchUser() {
         // LIKE
-        PagedResult<UserTO> matchingUsers = userService.search(
-                new AnySearchQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
+        PagedResult<UserTO> matchingUsers = userService.search(new AnyQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
                 fiql(SyncopeClient.getUserSearchConditionBuilder().
                         is("fullname").equalTo("*o*").and("fullname").equalTo("*i*").query()).build());
         assertNotNull(matchingUsers);
@@ -60,8 +59,7 @@ public class SearchITCase extends AbstractITCase {
         }
 
         // ISNULL
-        matchingUsers = userService.search(
-                new AnySearchQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
+        matchingUsers = userService.search(new AnyQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
                 fiql(SyncopeClient.getUserSearchConditionBuilder().isNull("loginDate").query()).build());
         assertNotNull(matchingUsers);
         assertFalse(matchingUsers.getResult().isEmpty());
@@ -79,8 +77,7 @@ public class SearchITCase extends AbstractITCase {
 
     @Test
     public void searchByUsernameAndKey() {
-        PagedResult<UserTO> matchingUsers = userService.search(
-                new AnySearchQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
+        PagedResult<UserTO> matchingUsers = userService.search(new AnyQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
                 fiql(SyncopeClient.getUserSearchConditionBuilder().
                         is("username").equalTo("rossini").and("key").lessThan(2).query()).build());
         assertNotNull(matchingUsers);
@@ -91,8 +88,7 @@ public class SearchITCase extends AbstractITCase {
 
     @Test
     public void searchByGroupNameAndKey() {
-        PagedResult<GroupTO> groups = groupService.search(
-                new AnySearchQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
+        PagedResult<GroupTO> groups = groupService.search(new AnyQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
                 fiql(SyncopeClient.getGroupSearchConditionBuilder().
                         is("name").equalTo("root").and("key").equalTo("37d15e4c-cdc1-460b-a591-8505c8133806").
                         query()).build());
@@ -104,8 +100,7 @@ public class SearchITCase extends AbstractITCase {
 
     @Test
     public void searchByGroup() {
-        PagedResult<UserTO> matchingUsers = userService.search(
-                new AnySearchQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
+        PagedResult<UserTO> matchingUsers = userService.search(new AnyQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
                 fiql(SyncopeClient.getUserSearchConditionBuilder().
                         inGroups("37d15e4c-cdc1-460b-a591-8505c8133806").query()).
                 build());
@@ -128,8 +123,7 @@ public class SearchITCase extends AbstractITCase {
         group = createGroup(group).getAny();
         assertNotNull(group);
 
-        PagedResult<UserTO> matchingUsers = userService.search(
-                new AnySearchQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
+        PagedResult<UserTO> matchingUsers = userService.search(new AnyQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
                 fiql(SyncopeClient.getUserSearchConditionBuilder().inGroups(group.getKey()).query()).
                 build());
         assertNotNull(matchingUsers);
@@ -146,8 +140,7 @@ public class SearchITCase extends AbstractITCase {
 
     @Test
     public void searchByRole() {
-        PagedResult<UserTO> matchingUsers = userService.search(
-                new AnySearchQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
+        PagedResult<UserTO> matchingUsers = userService.search(new AnyQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
                 fiql(SyncopeClient.getUserSearchConditionBuilder().inRoles("Other").query()).
                 build());
         assertNotNull(matchingUsers);
@@ -170,8 +163,7 @@ public class SearchITCase extends AbstractITCase {
         role = getObject(response.getLocation(), RoleService.class, RoleTO.class);
         assertNotNull(role);
 
-        PagedResult<UserTO> matchingUsers = userService.search(
-                new AnySearchQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
+        PagedResult<UserTO> matchingUsers = userService.search(new AnyQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
                 fiql(SyncopeClient.getUserSearchConditionBuilder().inRoles(role.getKey()).query()).
                 build());
         assertNotNull(matchingUsers);
@@ -188,8 +180,7 @@ public class SearchITCase extends AbstractITCase {
 
     @Test
     public void searchUserByResourceName() {
-        PagedResult<UserTO> matchingUsers = userService.search(
-                new AnySearchQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
+        PagedResult<UserTO> matchingUsers = userService.search(new AnyQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
                 fiql(SyncopeClient.getUserSearchConditionBuilder().hasResources(RESOURCE_NAME_MAPPINGS2).query()).
                 build());
         assertNotNull(matchingUsers);
@@ -207,8 +198,7 @@ public class SearchITCase extends AbstractITCase {
     @Test
     public void paginatedSearch() {
         // LIKE
-        PagedResult<UserTO> matchingUsers = userService.search(
-                new AnySearchQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
+        PagedResult<UserTO> matchingUsers = userService.search(new AnyQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
                 fiql(SyncopeClient.getUserSearchConditionBuilder().
                         is("fullname").equalTo("*o*").and("fullname").equalTo("*i*").query()).page(1).size(2).build());
         assertNotNull(matchingUsers);
@@ -219,8 +209,7 @@ public class SearchITCase extends AbstractITCase {
         }
 
         // ISNULL
-        matchingUsers = userService.search(
-                new AnySearchQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
+        matchingUsers = userService.search(new AnyQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
                 fiql(SyncopeClient.getUserSearchConditionBuilder().isNull("loginDate").query()).page(2).size(2).
                 build());
         assertNotNull(matchingUsers);
@@ -230,8 +219,7 @@ public class SearchITCase extends AbstractITCase {
 
     @Test
     public void searchByBooleanAnyCond() {
-        PagedResult<GroupTO> groups = groupService.search(
-                new AnySearchQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
+        PagedResult<GroupTO> groups = groupService.search(new AnyQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
                 fiql(SyncopeClient.getGroupSearchConditionBuilder().is("show").equalTo("true").query()).build());
         assertNotNull(groups);
         assertFalse(groups.getResult().isEmpty());
@@ -241,8 +229,7 @@ public class SearchITCase extends AbstractITCase {
     public void searchByDate() {
         clientFactory.create("bellini", "password").self();
 
-        PagedResult<UserTO> users = userService.search(
-                new AnySearchQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
+        PagedResult<UserTO> users = userService.search(new AnyQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
                 fiql(SyncopeClient.getUserSearchConditionBuilder().
                         is("lastLoginDate").lexicalNotBefore("2016-03-02 15:21:22").
                         and("username").equalTo("bellini").query()).
@@ -254,8 +241,7 @@ public class SearchITCase extends AbstractITCase {
 
     @Test
     public void searchByRelationshipAnyCond() {
-        PagedResult<GroupTO> groups = groupService.search(
-                new AnySearchQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
+        PagedResult<GroupTO> groups = groupService.search(new AnyQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
                 fiql(SyncopeClient.getGroupSearchConditionBuilder().
                         is("userOwner").equalTo("823074dc-d280-436d-a7dd-07399fae48ec").query()).build());
         assertNotNull(groups);
@@ -267,8 +253,7 @@ public class SearchITCase extends AbstractITCase {
 
     @Test
     public void nested() {
-        PagedResult<UserTO> matchingUsers = userService.search(
-                new AnySearchQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
+        PagedResult<UserTO> matchingUsers = userService.search(new AnyQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
                 fiql("((fullname==*o*,fullname==*i*);$resources!=ws-target-resource-1)").page(1).size(2).build());
         assertNotNull(matchingUsers);
 
@@ -280,8 +265,7 @@ public class SearchITCase extends AbstractITCase {
 
     @Test
     public void searchByType() {
-        PagedResult<AnyObjectTO> matching = anyObjectService.search(
-                new AnySearchQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
+        PagedResult<AnyObjectTO> matching = anyObjectService.search(new AnyQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
                 fiql(SyncopeClient.getAnyObjectSearchConditionBuilder("PRINTER").query()).build());
         assertNotNull(matching);
 
@@ -290,8 +274,7 @@ public class SearchITCase extends AbstractITCase {
             assertNotNull(printer);
         }
 
-        matching = anyObjectService.search(
-                new AnySearchQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
+        matching = anyObjectService.search(new AnyQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
                 fiql(SyncopeClient.getAnyObjectSearchConditionBuilder("UNEXISTING").query()).build());
         assertNotNull(matching);
 
@@ -300,8 +283,7 @@ public class SearchITCase extends AbstractITCase {
 
     @Test
     public void searchByRelationship() {
-        PagedResult<AnyObjectTO> anyObjects = anyObjectService.search(
-                new AnySearchQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
+        PagedResult<AnyObjectTO> anyObjects = anyObjectService.search(new AnyQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
                 fiql(SyncopeClient.getAnyObjectSearchConditionBuilder("PRINTER").
                         inRelationships("8559d14d-58c2-46eb-a2d4-a7d35161e8f8").query()).
                 build());
@@ -314,8 +296,7 @@ public class SearchITCase extends AbstractITCase {
             }
         }));
 
-        PagedResult<UserTO> users = userService.search(
-                new AnySearchQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
+        PagedResult<UserTO> users = userService.search(new AnyQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
                 fiql(SyncopeClient.getUserSearchConditionBuilder().
                         inRelationships("fc6dbc3a-6c07-4965-8781-921e7401a4a5").query()).
                 build());
@@ -331,8 +312,7 @@ public class SearchITCase extends AbstractITCase {
 
     @Test
     public void searchByRelationshipType() {
-        PagedResult<AnyObjectTO> anyObjects = anyObjectService.search(
-                new AnySearchQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
+        PagedResult<AnyObjectTO> anyObjects = anyObjectService.search(new AnyQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
                 fiql(SyncopeClient.getAnyObjectSearchConditionBuilder("PRINTER").
                         inRelationshipTypes("neighborhood").query()).
                 build());
@@ -352,8 +332,7 @@ public class SearchITCase extends AbstractITCase {
             }
         }));
 
-        PagedResult<UserTO> users = userService.search(
-                new AnySearchQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
+        PagedResult<UserTO> users = userService.search(new AnyQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
                 fiql(SyncopeClient.getUserSearchConditionBuilder().inRelationshipTypes("neighborhood").query()).
                 build());
         assertNotNull(users);
@@ -368,8 +347,7 @@ public class SearchITCase extends AbstractITCase {
 
     @Test
     public void assignable() {
-        PagedResult<GroupTO> groups = groupService.search(
-                new AnySearchQuery.Builder().realm("/even/two").page(1).size(1000).
+        PagedResult<GroupTO> groups = groupService.search(new AnyQuery.Builder().realm("/even/two").page(1).size(1000).
                 fiql(SyncopeClient.getGroupSearchConditionBuilder().isAssignable().
                         and("name").equalTo("*").query()).
                 build());
@@ -389,8 +367,7 @@ public class SearchITCase extends AbstractITCase {
             }
         }));
 
-        PagedResult<AnyObjectTO> anyObjects = anyObjectService.search(
-                new AnySearchQuery.Builder().realm("/odd").
+        PagedResult<AnyObjectTO> anyObjects = anyObjectService.search(new AnyQuery.Builder().realm("/odd").
                 fiql(SyncopeClient.getAnyObjectSearchConditionBuilder("PRINTER").isAssignable().
                         and("name").equalTo("*").query()).
                 build());
@@ -406,8 +383,7 @@ public class SearchITCase extends AbstractITCase {
 
     @Test
     public void orderBy() {
-        PagedResult<UserTO> matchingUsers = userService.search(
-                new AnySearchQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
+        PagedResult<UserTO> matchingUsers = userService.search(new AnyQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
                 fiql(SyncopeClient.getUserSearchConditionBuilder().is("userId").equalTo("*@apache.org").query()).
                 orderBy(SyncopeClient.getOrderByClauseBuilder().asc("status").desc("firstname").build()).build());
         assertNotNull(matchingUsers);
@@ -420,20 +396,17 @@ public class SearchITCase extends AbstractITCase {
 
     @Test
     public void issueSYNCOPE768() {
-        int usersWithNullable = userService.search(
-                new AnySearchQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
+        int usersWithNullable = userService.search(new AnyQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
                 fiql(SyncopeClient.getUserSearchConditionBuilder().is("ctype").nullValue().query()).build()).
                 getTotalCount();
         assertTrue(usersWithNullable > 0);
 
-        int nonOrdered = userService.search(
-                new AnySearchQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
+        int nonOrdered = userService.search(new AnyQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
                 fiql(SyncopeClient.getUserSearchConditionBuilder().is("username").notNullValue().query()).build()).
                 getTotalCount();
         assertTrue(nonOrdered > 0);
 
-        int orderedByNullable = userService.search(
-                new AnySearchQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
+        int orderedByNullable = userService.search(new AnyQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
                 fiql(SyncopeClient.getUserSearchConditionBuilder().is("username").notNullValue().query()).
                 orderBy(SyncopeClient.getOrderByClauseBuilder().asc("ctype").build()).build()).
                 getTotalCount();