syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ilgro...@apache.org
Subject [1/2] syncope git commit: Cleaning up in preparation to SYNCOPE-1152
Date Tue, 11 Jul 2017 09:31:22 GMT
Repository: syncope
Updated Branches:
  refs/heads/2_0_X fead89205 -> 976202b8e
  refs/heads/master bd5c1af88 -> de9e20297


Cleaning up in preparation to SYNCOPE-1152


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

Branch: refs/heads/2_0_X
Commit: 976202b8ee45ad70ea8f06a47a56f0bea55a629d
Parents: fead892
Author: Francesco Chicchiriccò <ilgrosso@apache.org>
Authored: Tue Jul 11 11:31:06 2017 +0200
Committer: Francesco Chicchiriccò <ilgrosso@apache.org>
Committed: Tue Jul 11 11:31:06 2017 +0200

----------------------------------------------------------------------
 .../syncope/core/logic/AbstractAnyLogic.java    | 13 +----
 .../syncope/core/logic/AnyObjectLogic.java      | 40 ++++-----------
 .../apache/syncope/core/logic/GroupLogic.java   | 50 +++++-------------
 .../apache/syncope/core/logic/UserLogic.java    | 54 +++++---------------
 .../core/persistence/api/dao/AnyDAO.java        | 22 +++-----
 .../persistence/jpa/dao/AbstractAnyDAO.java     | 31 ++---------
 .../core/persistence/jpa/dao/JPAGroupDAO.java   | 11 ++++
 .../persistence/jpa/inner/AnyObjectTest.java    |  7 ---
 .../core/persistence/jpa/inner/UserTest.java    | 14 ++---
 .../rest/cxf/service/AbstractAnyService.java    | 48 ++++++++---------
 .../syncope/fit/console/TopologyITCase.java     |  2 +-
 .../apache/syncope/fit/core/LoggerITCase.java   |  4 +-
 12 files changed, 85 insertions(+), 211 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/976202b8/core/logic/src/main/java/org/apache/syncope/core/logic/AbstractAnyLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/AbstractAnyLogic.java
b/core/logic/src/main/java/org/apache/syncope/core/logic/AbstractAnyLogic.java
index bf83632..9755e1f 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/AbstractAnyLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/AbstractAnyLogic.java
@@ -263,24 +263,15 @@ public abstract class AbstractAnyLogic<TO extends AnyTO, P extends
AnyPatch> ext
 
     public abstract TO read(String key);
 
-    public abstract int count(String realm);
-
     public abstract ProvisioningResult<TO> create(TO anyTO, boolean nullPriorityAsync);
 
     public abstract ProvisioningResult<TO> update(P anyPatch, boolean nullPriorityAsync);
 
     public abstract ProvisioningResult<TO> delete(String key, boolean nullPriorityAsync);
 
-    public abstract List<TO> list(
-            int page, int size, List<OrderByClause> orderBy,
-            String realm,
-            boolean details);
-
-    public abstract List<TO> search(
-            SearchCond searchCondition,
+    public abstract Pair<Integer, List<TO>> search(
+            SearchCond searchCond,
             int page, int size, List<OrderByClause> orderBy,
             String realm,
             boolean details);
-
-    public abstract int searchCount(SearchCond searchCondition, String realm);
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/976202b8/core/logic/src/main/java/org/apache/syncope/core/logic/AnyObjectLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/AnyObjectLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/AnyObjectLogic.java
index 49d18db..8cab1aa 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/AnyObjectLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/AnyObjectLogic.java
@@ -90,22 +90,12 @@ public class AnyObjectLogic extends AbstractAnyLogic<AnyObjectTO, AnyObjectPatch
 
     @Transactional(readOnly = true)
     @Override
-    public int count(final String realm) {
-        throw new UnsupportedOperationException("Need to specify " + AnyType.class.getSimpleName());
-    }
-
-    @Transactional(readOnly = true)
-    @Override
-    public List<AnyObjectTO> list(
+    public Pair<Integer, List<AnyObjectTO>> search(
+            final SearchCond searchCond,
             final int page, final int size, final List<OrderByClause> orderBy,
-            final String realm, final boolean details) {
-
-        throw new UnsupportedOperationException("Need to specify " + AnyType.class.getSimpleName());
-    }
+            final String realm,
+            final boolean details) {
 
-    @Transactional(readOnly = true)
-    @Override
-    public int searchCount(final SearchCond searchCond, final String realm) {
         if (searchCond.hasAnyTypeCond() == null) {
             throw new UnsupportedOperationException("Need to specify " + AnyType.class.getSimpleName());
         }
@@ -114,25 +104,11 @@ public class AnyObjectLogic extends AbstractAnyLogic<AnyObjectTO,
AnyObjectPatch
                 AuthContextUtils.getAuthorizations().get(AnyEntitlement.SEARCH.getFor(searchCond.hasAnyTypeCond())),
                 realm);
 
-        return searchDAO.count(effectiveRealms, searchCond, AnyTypeKind.ANY_OBJECT);
-    }
+        int count = searchDAO.count(effectiveRealms, searchCond, AnyTypeKind.ANY_OBJECT);
 
-    @Transactional(readOnly = true)
-    @Override
-    public List<AnyObjectTO> search(final SearchCond searchCond, final int page, final
int size,
-            final List<OrderByClause> orderBy, final String realm, final boolean details)
{
-
-        if (searchCond.hasAnyTypeCond() == null) {
-            throw new UnsupportedOperationException("Need to specify " + AnyType.class.getSimpleName());
-        }
-
-        Set<String> effectiveRealms = RealmUtils.getEffective(
-                AuthContextUtils.getAuthorizations().get(AnyEntitlement.SEARCH.getFor(searchCond.hasAnyTypeCond())),
-                realm);
-
-        List<AnyObject> matchingAnyObjects = searchDAO.search(
+        List<AnyObject> matching = searchDAO.search(
                 effectiveRealms, searchCond, page, size, orderBy, AnyTypeKind.ANY_OBJECT);
-        return CollectionUtils.collect(matchingAnyObjects, new Transformer<AnyObject,
AnyObjectTO>() {
+        List<AnyObjectTO> result = CollectionUtils.collect(matching, new Transformer<AnyObject,
AnyObjectTO>() {
 
             @Transactional(readOnly = true)
             @Override
@@ -140,6 +116,8 @@ public class AnyObjectLogic extends AbstractAnyLogic<AnyObjectTO, AnyObjectPatch
                 return binder.getAnyObjectTO(input, details);
             }
         }, new ArrayList<AnyObjectTO>());
+
+        return Pair.of(count, result);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/syncope/blob/976202b8/core/logic/src/main/java/org/apache/syncope/core/logic/GroupLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/GroupLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/GroupLogic.java
index 7e9b88b..4420d4d 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/GroupLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/GroupLogic.java
@@ -176,49 +176,21 @@ public class GroupLogic extends AbstractAnyLogic<GroupTO, GroupPatch>
{
     @PreAuthorize("isAuthenticated()")
     @Transactional(readOnly = true)
     @Override
-    public int count(final String realm) {
-        return groupDAO.count(RealmUtils.getEffective(SyncopeConstants.FULL_ADMIN_REALMS,
realm));
-    }
-
-    @PreAuthorize("isAuthenticated()")
-    @Transactional(readOnly = true)
-    @Override
-    public List<GroupTO> list(
+    public Pair<Integer, List<GroupTO>> search(
+            final SearchCond searchCond,
             final int page, final int size, final List<OrderByClause> orderBy,
-            final String realm, final boolean details) {
+            final String realm,
+            final boolean details) {
 
-        return CollectionUtils.collect(groupDAO.findAll(
+        int count = searchDAO.count(
                 RealmUtils.getEffective(SyncopeConstants.FULL_ADMIN_REALMS, realm),
-                page, size, orderBy),
-                new Transformer<Group, GroupTO>() {
+                searchCond == null ? groupDAO.getAllMatchingCond() : searchCond, AnyTypeKind.GROUP);
 
-            @Transactional(readOnly = true)
-            @Override
-            public GroupTO transform(final Group input) {
-                return binder.getGroupTO(input, details);
-            }
-        }, new ArrayList<GroupTO>());
-    }
-
-    @PreAuthorize("isAuthenticated()")
-    @Transactional(readOnly = true)
-    @Override
-    public int searchCount(final SearchCond searchCondition, final String realm) {
-        return searchDAO.count(
-                RealmUtils.getEffective(SyncopeConstants.FULL_ADMIN_REALMS, realm),
-                searchCondition, AnyTypeKind.GROUP);
-    }
-
-    @PreAuthorize("isAuthenticated()")
-    @Transactional(readOnly = true)
-    @Override
-    public List<GroupTO> search(final SearchCond searchCondition, final int page, final
int size,
-            final List<OrderByClause> orderBy, final String realm, final boolean details)
{
-
-        List<Group> matchingGroups = searchDAO.search(
+        List<Group> matching = searchDAO.search(
                 RealmUtils.getEffective(SyncopeConstants.FULL_ADMIN_REALMS, realm),
-                searchCondition, page, size, orderBy, AnyTypeKind.GROUP);
-        return CollectionUtils.collect(matchingGroups, new Transformer<Group, GroupTO>()
{
+                searchCond == null ? groupDAO.getAllMatchingCond() : searchCond,
+                page, size, orderBy, AnyTypeKind.GROUP);
+        List<GroupTO> result = CollectionUtils.collect(matching, new Transformer<Group,
GroupTO>() {
 
             @Transactional(readOnly = true)
             @Override
@@ -226,6 +198,8 @@ public class GroupLogic extends AbstractAnyLogic<GroupTO, GroupPatch>
{
                 return binder.getGroupTO(input, details);
             }
         }, new ArrayList<GroupTO>());
+
+        return Pair.of(count, result);
     }
 
     @PreAuthorize("hasRole('" + StandardEntitlement.GROUP_CREATE + "')")

http://git-wip-us.apache.org/repos/asf/syncope/blob/976202b8/core/logic/src/main/java/org/apache/syncope/core/logic/UserLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/UserLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/UserLogic.java
index ee68a4e..ffca88b 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/UserLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/UserLogic.java
@@ -92,33 +92,6 @@ public class UserLogic extends AbstractAnyLogic<UserTO, UserPatch>
{
         return etag;
     }
 
-    @PreAuthorize("hasRole('" + StandardEntitlement.USER_SEARCH + "')")
-    @Transactional(readOnly = true)
-    @Override
-    public int count(final String realm) {
-        return userDAO.count(RealmUtils.getEffective(
-                AuthContextUtils.getAuthorizations().get(StandardEntitlement.USER_SEARCH),
realm));
-    }
-
-    @PreAuthorize("hasRole('" + StandardEntitlement.USER_SEARCH + "')")
-    @Transactional(readOnly = true)
-    @Override
-    public List<UserTO> list(
-            final int page, final int size, final List<OrderByClause> orderBy,
-            final String realm, final boolean details) {
-
-        return CollectionUtils.collect(userDAO.findAll(RealmUtils.getEffective(
-                AuthContextUtils.getAuthorizations().get(StandardEntitlement.USER_SEARCH),
realm), page, size, orderBy),
-                new Transformer<User, UserTO>() {
-
-            @Transactional(readOnly = true)
-            @Override
-            public UserTO transform(final User input) {
-                return binder.returnUserTO(binder.getUserTO(input, details));
-            }
-        }, new ArrayList<UserTO>());
-    }
-
     @PreAuthorize("isAuthenticated()")
     @Transactional(readOnly = true)
     public Pair<String, UserTO> selfRead() {
@@ -137,22 +110,21 @@ public class UserLogic extends AbstractAnyLogic<UserTO, UserPatch>
{
     @PreAuthorize("hasRole('" + StandardEntitlement.USER_SEARCH + "')")
     @Transactional(readOnly = true)
     @Override
-    public int searchCount(final SearchCond searchCondition, final String realm) {
-        return searchDAO.count(RealmUtils.getEffective(
-                AuthContextUtils.getAuthorizations().get(StandardEntitlement.USER_SEARCH),
realm),
-                searchCondition, AnyTypeKind.USER);
-    }
+    public Pair<Integer, List<UserTO>> search(
+            final SearchCond searchCond,
+            final int page, final int size, final List<OrderByClause> orderBy,
+            final String realm,
+            final boolean details) {
 
-    @PreAuthorize("hasRole('" + StandardEntitlement.USER_SEARCH + "')")
-    @Transactional(readOnly = true)
-    @Override
-    public List<UserTO> search(final SearchCond searchCondition, final int page, final
int size,
-            final List<OrderByClause> orderBy, final String realm, final boolean details)
{
+        int count = searchDAO.count(RealmUtils.getEffective(
+                AuthContextUtils.getAuthorizations().get(StandardEntitlement.USER_SEARCH),
realm),
+                searchCond == null ? userDAO.getAllMatchingCond() : searchCond, AnyTypeKind.USER);
 
-        List<User> matchingUsers = searchDAO.search(RealmUtils.getEffective(
+        List<User> matching = searchDAO.search(RealmUtils.getEffective(
                 AuthContextUtils.getAuthorizations().get(StandardEntitlement.USER_SEARCH),
realm),
-                searchCondition, page, size, orderBy, AnyTypeKind.USER);
-        return CollectionUtils.collect(matchingUsers, new Transformer<User, UserTO>()
{
+                searchCond == null ? userDAO.getAllMatchingCond() : searchCond,
+                page, size, orderBy, AnyTypeKind.USER);
+        List<UserTO> result = CollectionUtils.collect(matching, new Transformer<User,
UserTO>() {
 
             @Transactional(readOnly = true)
             @Override
@@ -160,6 +132,8 @@ public class UserLogic extends AbstractAnyLogic<UserTO, UserPatch>
{
                 return binder.returnUserTO(binder.getUserTO(input, details));
             }
         }, new ArrayList<UserTO>());
+
+        return Pair.of(count, result);
     }
 
     @PreAuthorize("isAnonymous() or hasRole('" + StandardEntitlement.ANONYMOUS + "')")

http://git-wip-us.apache.org/repos/asf/syncope/blob/976202b8/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/AnyDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/AnyDAO.java
b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/AnyDAO.java
index 75b0411..c161ee7 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/AnyDAO.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/AnyDAO.java
@@ -20,8 +20,7 @@ package org.apache.syncope.core.persistence.api.dao;
 
 import java.util.Date;
 import java.util.List;
-import java.util.Set;
-import org.apache.syncope.core.persistence.api.dao.search.OrderByClause;
+import org.apache.syncope.core.persistence.api.dao.search.SearchCond;
 import org.apache.syncope.core.persistence.api.entity.Any;
 import org.apache.syncope.core.persistence.api.entity.resource.ExternalResource;
 import org.apache.syncope.core.persistence.api.entity.PlainAttrValue;
@@ -58,6 +57,11 @@ public interface AnyDAO<A extends Any<?>> extends DAO<A>
{
     List<A> findByResource(ExternalResource resource);
 
     /**
+     * @return the search condition to match all entities
+     */
+    SearchCond getAllMatchingCond();
+
+    /**
      * @return the total number of any objects of type {@link A}
      */
     int count();
@@ -71,22 +75,8 @@ public interface AnyDAO<A extends Any<?>> extends DAO<A>
{
      */
     List<A> findAll(int page, int itemsPerPage);
 
-    /**
-     * Find any objects visible from the given admin realms, according to given page and
items per page, sorted as
-     * required.
-     *
-     * @param adminRealms admin realms
-     * @param page search result page
-     * @param itemsPerPage items per search result page
-     * @param orderBy ordering clauses
-     * @return any objects of type {@link A} matching the provided conditions
-     */
-    List<A> findAll(Set<String> adminRealms, int page, int itemsPerPage, List<OrderByClause>
orderBy);
-
     <S extends Schema> AllowedSchemas<S> findAllowedSchemas(A any, Class<S>
reference);
 
-    int count(Set<String> adminRealms);
-
     A save(A any);
 
     void delete(String key);

http://git-wip-us.apache.org/repos/asf/syncope/blob/976202b8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/AbstractAnyDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/AbstractAnyDAO.java
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/AbstractAnyDAO.java
index 394359b..6ef6826 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/AbstractAnyDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/AbstractAnyDAO.java
@@ -39,14 +39,12 @@ import org.apache.commons.jexl3.parser.Token;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.syncope.core.persistence.api.dao.AllowedSchemas;
 import org.apache.syncope.core.persistence.api.dao.AnyDAO;
-import org.apache.syncope.core.persistence.api.dao.AnySearchDAO;
 import org.apache.syncope.core.persistence.api.dao.DerSchemaDAO;
 import org.apache.syncope.core.persistence.api.dao.DynRealmDAO;
 import org.apache.syncope.core.persistence.api.dao.NotFoundException;
 import org.apache.syncope.core.persistence.api.dao.PlainSchemaDAO;
 import org.apache.syncope.core.persistence.api.dao.search.AnyCond;
 import org.apache.syncope.core.persistence.api.dao.search.AttributeCond;
-import org.apache.syncope.core.persistence.api.dao.search.OrderByClause;
 import org.apache.syncope.core.persistence.api.dao.search.SearchCond;
 import org.apache.syncope.core.persistence.api.entity.Any;
 import org.apache.syncope.core.persistence.api.entity.AnyTypeClass;
@@ -80,8 +78,6 @@ public abstract class AbstractAnyDAO<A extends Any<?>> extends
AbstractDAO<A> im
 
     private DerSchemaDAO derSchemaDAO;
 
-    private AnySearchDAO searchDAO;
-
     private DynRealmDAO dynRealmDAO;
 
     private AnyUtils anyUtils;
@@ -104,15 +100,6 @@ public abstract class AbstractAnyDAO<A extends Any<?>> extends
AbstractDAO<A> im
         return derSchemaDAO;
     }
 
-    protected AnySearchDAO searchDAO() {
-        synchronized (this) {
-            if (searchDAO == null) {
-                searchDAO = ApplicationContextProvider.getApplicationContext().getBean(AnySearchDAO.class);
-            }
-        }
-        return searchDAO;
-    }
-
     protected DynRealmDAO dynRealmDAO() {
         synchronized (this) {
             if (dynRealmDAO == null) {
@@ -461,20 +448,13 @@ public abstract class AbstractAnyDAO<A extends Any<?>> extends
AbstractDAO<A> im
         return query.getResultList();
     }
 
-    private SearchCond getAllMatchingCond() {
+    @Override
+    public SearchCond getAllMatchingCond() {
         AnyCond idCond = new AnyCond(AttributeCond.Type.ISNOTNULL);
         idCond.setSchema("id");
         return SearchCond.getLeafCond(idCond);
     }
 
-    @Override
-    public List<A> findAll(final Set<String> adminRealms,
-            final int page, final int itemsPerPage, final List<OrderByClause> orderBy)
{
-
-        return searchDAO().search(adminRealms, getAllMatchingCond(), page, itemsPerPage,
orderBy,
-                anyUtils().getAnyTypeKind());
-    }
-
     @Transactional(propagation = Propagation.REQUIRES_NEW, readOnly = true)
     @Override
     @SuppressWarnings("unchecked")
@@ -534,11 +514,6 @@ public abstract class AbstractAnyDAO<A extends Any<?>> extends
AbstractDAO<A> im
     }
 
     @Override
-    public final int count(final Set<String> adminRealms) {
-        return searchDAO().count(adminRealms, getAllMatchingCond(), anyUtils().getAnyTypeKind());
-    }
-
-    @Override
     public A save(final A any) {
         return entityManager().merge(any);
     }
@@ -569,7 +544,7 @@ public abstract class AbstractAnyDAO<A extends Any<?>> extends
AbstractDAO<A> im
             DynRealm dynRealm = dynRealmDAO().find(actualKey);
             if (dynRealm == null) {
                 LOG.error("Could not find dynRealm with id {}, even though returned by the
native query", actualKey);
-            } else if (!result.contains(dynRealm)) {
+            } else if (!result.contains(actualKey)) {
                 result.add(actualKey);
             }
         }

http://git-wip-us.apache.org/repos/asf/syncope/blob/976202b8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAGroupDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAGroupDAO.java
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAGroupDAO.java
index 4fb49e1..e4e34a3 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAGroupDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAGroupDAO.java
@@ -89,6 +89,8 @@ public class JPAGroupDAO extends AbstractAnyDAO<Group> implements
GroupDAO {
 
     private AnyObjectDAO anyObjectDAO;
 
+    private AnySearchDAO searchDAO;
+
     private AnySearchDAO jpaAnySearchDAO;
 
     private UserDAO userDAO() {
@@ -109,6 +111,15 @@ public class JPAGroupDAO extends AbstractAnyDAO<Group> implements
GroupDAO {
         return anyObjectDAO;
     }
 
+    private AnySearchDAO searchDAO() {
+        synchronized (this) {
+            if (searchDAO == null) {
+                searchDAO = ApplicationContextProvider.getApplicationContext().getBean(AnySearchDAO.class);
+            }
+        }
+        return searchDAO;
+    }
+
     private AnySearchDAO jpaAnySearchDAO() {
         synchronized (this) {
             if (jpaAnySearchDAO == null) {

http://git-wip-us.apache.org/repos/asf/syncope/blob/976202b8/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/AnyObjectTest.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/AnyObjectTest.java
b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/AnyObjectTest.java
index 3f4d48a..18172c5 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/AnyObjectTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/AnyObjectTest.java
@@ -22,7 +22,6 @@ import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 
-import java.util.List;
 import org.apache.syncope.common.lib.SyncopeConstants;
 import org.apache.syncope.core.persistence.api.dao.AnyObjectDAO;
 import org.apache.syncope.core.persistence.api.dao.AnyTypeDAO;
@@ -46,12 +45,6 @@ public class AnyObjectTest extends AbstractTest {
     private RealmDAO realmDAO;
 
     @Test
-    public void findAll() {
-        List<AnyObject> list = anyObjectDAO.findAll(1, 100);
-        assertFalse(list.isEmpty());
-    }
-
-    @Test
     public void find() {
         AnyObject anyObject = anyObjectDAO.find("8559d14d-58c2-46eb-a2d4-a7d35161e8f8");
         assertNotNull(anyObject);

http://git-wip-us.apache.org/repos/asf/syncope/blob/976202b8/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/UserTest.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/UserTest.java
b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/UserTest.java
index 101e2b5..e5dcdd4 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/UserTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/UserTest.java
@@ -23,10 +23,8 @@ import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.fail;
 
-import java.util.Collections;
 import java.util.Date;
 import java.util.List;
-import org.apache.syncope.common.lib.SyncopeConstants;
 import org.apache.syncope.common.lib.types.CipherAlgorithm;
 import org.apache.syncope.core.persistence.api.attrvalue.validation.InvalidEntityException;
 import org.apache.syncope.core.persistence.api.dao.UserDAO;
@@ -36,7 +34,6 @@ import org.apache.syncope.core.persistence.jpa.AbstractTest;
 import org.apache.syncope.core.provisioning.api.utils.policy.InvalidPasswordRuleConf;
 import org.apache.syncope.core.spring.security.PasswordGenerator;
 import org.apache.syncope.core.persistence.api.dao.RealmDAO;
-import org.apache.syncope.core.persistence.api.dao.search.OrderByClause;
 import org.junit.Test;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
@@ -61,7 +58,7 @@ public class UserTest extends AbstractTest {
 
     @Test
     public void count() {
-        Integer count = userDAO.count(SyncopeConstants.FULL_ADMIN_REALMS);
+        Integer count = userDAO.count();
         assertNotNull(count);
         assertEquals(5, count, 0);
     }
@@ -69,20 +66,19 @@ public class UserTest extends AbstractTest {
     @Test
     public void findAllByPageAndSize() {
         // get first page
-        List<User> list = userDAO.findAll(
-                SyncopeConstants.FULL_ADMIN_REALMS, 1, 2, Collections.<OrderByClause>emptyList());
+        List<User> list = userDAO.findAll(1, 2);
         assertEquals("did not get expected number of users", 2, list.size());
 
         // get second page
-        list = userDAO.findAll(SyncopeConstants.FULL_ADMIN_REALMS, 2, 2, Collections.<OrderByClause>emptyList());
+        list = userDAO.findAll(2, 2);
         assertEquals("did not get expected number of users", 2, list.size());
 
         // get second page with uncomplete set
-        list = userDAO.findAll(SyncopeConstants.FULL_ADMIN_REALMS, 2, 3, Collections.<OrderByClause>emptyList());
+        list = userDAO.findAll(2, 3);
         assertEquals("did not get expected number of users", 2, list.size());
 
         // get unexistent page
-        list = userDAO.findAll(SyncopeConstants.FULL_ADMIN_REALMS, 3, 2, Collections.<OrderByClause>emptyList());
+        list = userDAO.findAll(3, 2);
         assertEquals("did not get expected number of users", 1, list.size());
     }
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/976202b8/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 0574d82..2cc2413 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
@@ -19,10 +19,12 @@
 package org.apache.syncope.core.rest.cxf.service;
 
 import java.util.Date;
+import java.util.List;
 import java.util.Set;
 import javax.ws.rs.BadRequestException;
 import javax.ws.rs.core.Response;
 import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.tuple.Pair;
 import org.apache.syncope.common.lib.AnyOperations;
 import org.apache.syncope.common.lib.SyncopeConstants;
 import org.apache.syncope.common.lib.patch.AnyPatch;
@@ -115,34 +117,24 @@ public abstract class AbstractAnyService<TO extends AnyTO, P extends
AnyPatch>
     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));
-        }
+        // if an assignable query is provided in the FIQL string, start anyway from root
realm
+        boolean isAssignableCond = StringUtils.isBlank(anyQuery.getFiql())
+                ? false
+                : -1 != anyQuery.getFiql().indexOf(SpecialAttr.ASSIGNABLE.toString());
+
+        SearchCond searchCond = StringUtils.isBlank(anyQuery.getFiql())
+                ? null
+                : getSearchCond(anyQuery.getFiql(), realm);
+
+        Pair<Integer, List<TO>> result = getAnyLogic().search(
+                searchCond,
+                anyQuery.getPage(),
+                anyQuery.getSize(),
+                getOrderByClauses(anyQuery.getOrderBy()),
+                isAssignableCond ? SyncopeConstants.ROOT_REALM : realm,
+                anyQuery.getDetails());
+
+        return buildPagedResult(result.getRight(), anyQuery.getPage(), anyQuery.getSize(),
result.getLeft());
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/syncope/blob/976202b8/fit/core-reference/src/test/java/org/apache/syncope/fit/console/TopologyITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/console/TopologyITCase.java
b/fit/core-reference/src/test/java/org/apache/syncope/fit/console/TopologyITCase.java
index a4723c7..302441e 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/console/TopologyITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/console/TopologyITCase.java
@@ -389,7 +389,7 @@ public class TopologyITCase extends AbstractConsoleITCase {
 
         TESTER.assertLabel(
                 "body:toggle:outerObjectsRepeater:1:outer:form:content:tasks:secondLevelContainer:title",
-                "CREATE task about USER");
+                "CREATE __ACCOUNT__");
 
         component = findComponentByProp("status", "body:toggle:outerObjectsRepeater:1:outer:form:content:tasks:"
                 + "secondLevelContainer:second:executions:firstLevelContainer:first:container:content:searchContainer:"

http://git-wip-us.apache.org/repos/asf/syncope/blob/976202b8/fit/core-reference/src/test/java/org/apache/syncope/fit/core/LoggerITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/LoggerITCase.java
b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/LoggerITCase.java
index 7e38c19..5720785 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/LoggerITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/LoggerITCase.java
@@ -162,7 +162,7 @@ public class LoggerITCase extends AbstractITCase {
             if (UserLogic.class.getSimpleName().equals(eventCategoryTO.getCategory())) {
                 assertEquals(EventCategoryType.LOGIC, eventCategoryTO.getType());
                 assertTrue(eventCategoryTO.getEvents().contains("create"));
-                assertTrue(eventCategoryTO.getEvents().contains("list"));
+                assertTrue(eventCategoryTO.getEvents().contains("search"));
                 assertFalse(eventCategoryTO.getEvents().contains("doCreate"));
                 assertFalse(eventCategoryTO.getEvents().contains("setStatusOnWfAdapter"));
                 assertFalse(eventCategoryTO.getEvents().contains("resolveReference"));
@@ -176,7 +176,7 @@ public class LoggerITCase extends AbstractITCase {
             if (GroupLogic.class.getSimpleName().equals(eventCategoryTO.getCategory())) {
                 assertEquals(EventCategoryType.LOGIC, eventCategoryTO.getType());
                 assertTrue(eventCategoryTO.getEvents().contains("create"));
-                assertTrue(eventCategoryTO.getEvents().contains("list"));
+                assertTrue(eventCategoryTO.getEvents().contains("search"));
                 assertFalse(eventCategoryTO.getEvents().contains("resolveReference"));
                 found = true;
             }


Mime
View raw message