mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Added support for paging using SearchParameters on the SearchService API (ARCHIVE-85)
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@14651 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -63,11 +63,11 @@ public class CMISResultSetImpl implements CMISResultSet, Serializable
|
||||
Query query;
|
||||
|
||||
CMISDictionaryService cmisDictionaryService;
|
||||
|
||||
|
||||
DictionaryService alfrescoDictionaryService;
|
||||
|
||||
|
||||
public CMISResultSetImpl(Map<String, ResultSet> wrapped, CMISQueryOptions options, NodeService nodeService, Query query, CMISDictionaryService cmisDictionaryService, DictionaryService alfrescoDictionaryService)
|
||||
public CMISResultSetImpl(Map<String, ResultSet> wrapped, CMISQueryOptions options, NodeService nodeService, Query query, CMISDictionaryService cmisDictionaryService,
|
||||
DictionaryService alfrescoDictionaryService)
|
||||
{
|
||||
this.wrapped = wrapped;
|
||||
this.options = options;
|
||||
@@ -125,17 +125,10 @@ public class CMISResultSetImpl implements CMISResultSet, Serializable
|
||||
{
|
||||
for (ResultSet resultSet : wrapped.values())
|
||||
{
|
||||
if (resultSet.getResultSetMetaData().getLimitedBy() != LimitBy.UNLIMITED)
|
||||
if (resultSet.hasMore())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(resultSet.length() - getStart() > getLength() )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -149,16 +142,7 @@ public class CMISResultSetImpl implements CMISResultSet, Serializable
|
||||
{
|
||||
for (ResultSet resultSet : wrapped.values())
|
||||
{
|
||||
int max = options.getMaxItems();
|
||||
int skip = options.getSkipCount();
|
||||
if((max >= 0) && (max < (resultSet.length() - skip)))
|
||||
{
|
||||
return options.getMaxItems();
|
||||
}
|
||||
else
|
||||
{
|
||||
return resultSet.length() - skip;
|
||||
}
|
||||
return resultSet.length();
|
||||
}
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
@@ -189,7 +173,7 @@ public class CMISResultSetImpl implements CMISResultSet, Serializable
|
||||
for (String selector : wrapped.keySet())
|
||||
{
|
||||
ResultSet rs = wrapped.get(selector);
|
||||
refs.put(selector, rs.getNodeRef(getStart() + i));
|
||||
refs.put(selector, rs.getNodeRef(i));
|
||||
}
|
||||
return refs;
|
||||
}
|
||||
@@ -200,7 +184,7 @@ public class CMISResultSetImpl implements CMISResultSet, Serializable
|
||||
for (String selector : wrapped.keySet())
|
||||
{
|
||||
ResultSet rs = wrapped.get(selector);
|
||||
scores.put(selector, Float.valueOf(rs.getScore(getStart() + i)));
|
||||
scores.put(selector, Float.valueOf(rs.getScore(i)));
|
||||
}
|
||||
return scores;
|
||||
}
|
||||
@@ -211,8 +195,6 @@ public class CMISResultSetImpl implements CMISResultSet, Serializable
|
||||
return nodeService.getPrimaryParent(nodeRef);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public List<ChildAssociationRef> getChildAssocRefs()
|
||||
{
|
||||
ArrayList<ChildAssociationRef> cars = new ArrayList<ChildAssociationRef>(length());
|
||||
@@ -226,7 +208,7 @@ public class CMISResultSetImpl implements CMISResultSet, Serializable
|
||||
public NodeRef getNodeRef(int n)
|
||||
{
|
||||
Map<String, NodeRef> refs = getNodeRefs(n);
|
||||
if(refs.size() == 1)
|
||||
if (refs.size() == 1)
|
||||
{
|
||||
return refs.values().iterator().next();
|
||||
}
|
||||
@@ -253,15 +235,15 @@ public class CMISResultSetImpl implements CMISResultSet, Serializable
|
||||
|
||||
public float getScore(int n)
|
||||
{
|
||||
Map<String, Float> scores = getScores(n);
|
||||
if(scores.size() == 1)
|
||||
{
|
||||
return scores.values().iterator().next();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new IllegalStateException("Ambiguous selector");
|
||||
}
|
||||
Map<String, Float> scores = getScores(n);
|
||||
if (scores.size() == 1)
|
||||
{
|
||||
return scores.values().iterator().next();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new IllegalStateException("Ambiguous selector");
|
||||
}
|
||||
}
|
||||
|
||||
public int length()
|
||||
|
Reference in New Issue
Block a user