ALF-7167 (RINF 11) - CQ

- fix executeQuery for nested result map (need to allow unbounded - see comment)
- also: trivial fix to GetAuthorities CQ (remove @SuppressWarnings)

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@28727 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Jan Vonka
2011-06-30 14:35:07 +00:00
parent eddc7efe0c
commit da43c06b68
2 changed files with 17 additions and 3 deletions

View File

@@ -130,15 +130,29 @@ public class CannedQueryDAOImpl extends AbstractCannedQueryDAOImpl
{
throw new IllegalArgumentException("Query result offset must be zero or greater.");
}
// TODO MyBatis workaround - temporarily support unlimited for nested result maps (see also below)
/*
if (limit <= 0 || limit == Integer.MAX_VALUE)
{
throw new IllegalArgumentException("Query results must be constrained by a limit.");
}
*/
String query = makeQueryName(sqlNamespace, queryName);
try
{
RowBounds bounds = new RowBounds(offset, limit);
return (List<R>) template.selectList(query, parameterObj, bounds);
if ((offset == 0) && (limit == Integer.MAX_VALUE))
{
// TODO MyBatis workaround - temporarily support unlimited for nested result maps (see also above)
// http://code.google.com/p/mybatis/issues/detail?id=129
return (List<R>) template.selectList(query, parameterObj);
}
else
{
RowBounds bounds = new RowBounds(offset, limit);
return (List<R>) template.selectList(query, parameterObj, bounds);
}
}
catch (ClassCastException e)
{

View File

@@ -161,7 +161,7 @@ public class GetAuthoritiesCannedQuery extends AbstractCannedQueryPermissions<Au
return true;
}
@SuppressWarnings({ "unchecked", "rawtypes" })
@SuppressWarnings({ "unchecked"})
protected List<AuthorityInfo> applyPostQuerySorting(List<AuthorityInfo> results, CannedQuerySortDetails sortDetails)
{
final List<Pair<Object, SortOrder>> sortPairs = (List)sortDetails.getSortPairs();