First pass at fixes/extensions/tidy ups to the search API - part of wiring FTS up as a query language MOB-568

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@14361 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Andrew Hind
2009-05-19 14:06:15 +00:00
parent 418035df05
commit d195ff8542
37 changed files with 2085 additions and 1261 deletions

View File

@@ -418,7 +418,7 @@ public class ACLEntryAfterInvocationTest extends AbstractPermissionTest
Set<ChildAssociationRef> carSet = new HashSet<ChildAssociationRef>();
ChildAssocRefResultSet rsIn = new ChildAssocRefResultSet(nodeService, nodeRefList, null, false);
ChildAssocRefResultSet rsIn = new ChildAssocRefResultSet(nodeService, nodeRefList, false);
assertEquals(0, rsIn.length());
ResultSet answerResultSet = (ResultSet) methodResultSet.invoke(proxy, new Object[] { rsIn });
@@ -488,7 +488,7 @@ public class ACLEntryAfterInvocationTest extends AbstractPermissionTest
Set<ChildAssociationRef> carSet = new HashSet<ChildAssociationRef>();
carSet.addAll(carList);
ChildAssocRefResultSet rsIn = new ChildAssocRefResultSet(nodeService, nodeRefList, null, false);
ChildAssocRefResultSet rsIn = new ChildAssocRefResultSet(nodeService, nodeRefList, false);
assertEquals(4, rsIn.length());
ResultSet answerResultSet = (ResultSet) methodResultSet.invoke(proxy, new Object[] { rsIn });
@@ -549,7 +549,7 @@ public class ACLEntryAfterInvocationTest extends AbstractPermissionTest
Set<ChildAssociationRef> carSet = new HashSet<ChildAssociationRef>();
carSet.addAll(carList);
ChildAssocRefResultSet rsIn = new ChildAssocRefResultSet(nodeService, nodeRefList, null, false);
ChildAssocRefResultSet rsIn = new ChildAssocRefResultSet(nodeService, nodeRefList, false);
assertEquals(4, rsIn.length());
@@ -622,7 +622,7 @@ public class ACLEntryAfterInvocationTest extends AbstractPermissionTest
Set<ChildAssociationRef> carSet = new HashSet<ChildAssociationRef>();
carSet.addAll(carList);
ChildAssocRefResultSet rsIn = new ChildAssocRefResultSet(nodeService, nodeRefList, null, false);
ChildAssocRefResultSet rsIn = new ChildAssocRefResultSet(nodeService, nodeRefList, false);
permissionService.setPermission(new SimplePermissionEntry(rootNodeRef, getPermission(PermissionService.READ), "andy", AccessStatus.ALLOWED));
@@ -746,7 +746,7 @@ public class ACLEntryAfterInvocationTest extends AbstractPermissionTest
Set<ChildAssociationRef> carSet = new HashSet<ChildAssociationRef>();
carSet.addAll(carList);
ChildAssocRefResultSet rsIn = new ChildAssocRefResultSet(nodeService, nodeRefList, null, false);
ChildAssocRefResultSet rsIn = new ChildAssocRefResultSet(nodeService, nodeRefList, false);
permissionService.setPermission(new SimplePermissionEntry(rootNodeRef, getPermission(PermissionService.READ), "andy", AccessStatus.ALLOWED));

View File

@@ -31,11 +31,15 @@ import java.util.ListIterator;
import org.alfresco.repo.search.ResultSetRowIterator;
import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.Path;
import org.alfresco.service.cmr.search.ResultSet;
import org.alfresco.service.cmr.search.ResultSetMetaData;
import org.alfresco.service.cmr.search.ResultSetRow;
/**
* Filtering result set to support permission checks
* @author andyh
*
*/
public class FilteringResultSet extends ACLEntryAfterInvocationProvider implements ResultSet
{
private ResultSet unfiltered;
@@ -66,11 +70,6 @@ public class FilteringResultSet extends ACLEntryAfterInvocationProvider implemen
return inclusionMask.get(i);
}
public Path[] getPropertyPaths()
{
return unfiltered.getPropertyPaths();
}
public int length()
{
return inclusionMask.cardinality();
@@ -253,6 +252,16 @@ public class FilteringResultSet extends ACLEntryAfterInvocationProvider implemen
throw new UnsupportedOperationException();
}
public boolean allowsReverse()
{
return true;
}
public ResultSet getResultSet()
{
return FilteringResultSet.this;
}
}
public ResultSetMetaData getResultSetMetaData()
@@ -265,5 +274,15 @@ public class FilteringResultSet extends ACLEntryAfterInvocationProvider implemen
this.resultSetMetaData = resultSetMetaData;
}
public int getStart()
{
throw new UnsupportedOperationException();
}
public boolean hasMore()
{
throw new UnsupportedOperationException();
}
}

View File

@@ -77,7 +77,7 @@ public class FilteringResultSetTest extends TestCase
cars.add(car4);
cars.add(car5);
ResultSet in = new ChildAssocRefResultSet(null, cars, null);
ResultSet in = new ChildAssocRefResultSet(null, cars);
FilteringResultSet filtering = new FilteringResultSet(in);