Merged V3.1 to HEAD

12867: Part 1: JAWS-220: Fix existing tests and tests for sort
    12879: JAWS-219: Part 1: First cut of support for CMIS objectid  = objectid joins
    12891: Complete minimalist support for Policies
    12912: CMIS Query: JAWS-219: Tests, fixes and better checking
    13062: Fix for ETHREEOH-1162:Issue with skipCount parameter for CMIS query service


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@13224 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Andrew Hind
2009-02-13 12:52:35 +00:00
parent fc69f52b45
commit 4e9a4cc1c6
59 changed files with 1734 additions and 1003 deletions

View File

@@ -26,11 +26,12 @@ package org.alfresco.cmis.search.impl;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import org.alfresco.cmis.CMISQueryEnum;
import org.alfresco.cmis.CMISService;
import org.alfresco.cmis.CMISFullTextSearchEnum;
import org.alfresco.cmis.CMISJoinEnum;
import org.alfresco.cmis.CMISQueryEnum;
import org.alfresco.cmis.CMISService;
import org.alfresco.cmis.dictionary.CMISDictionaryService;
import org.alfresco.cmis.dictionary.CMISMapping;
import org.alfresco.cmis.property.CMISPropertyService;
@@ -41,6 +42,7 @@ import org.alfresco.cmis.search.CMISResultSetImpl;
import org.alfresco.cmis.search.CmisFunctionEvaluationContext;
import org.alfresco.repo.search.impl.querymodel.Query;
import org.alfresco.repo.search.impl.querymodel.QueryEngine;
import org.alfresco.repo.search.impl.querymodel.QueryEngineResults;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.search.ResultSet;
@@ -122,17 +124,30 @@ public class CMISQueryServiceImpl implements CMISQueryService
*/
public CMISResultSet query(CMISQueryOptions options)
{
CMISQueryParser parser = new CMISQueryParser(options, cmisDictionaryService, cmisMapping, getJoinSupport());
CMISJoinEnum joinSupport = getJoinSupport();
if(options.getQueryMode() == CMISQueryOptions.CMISQueryMode.CMS_WITH_ALFRESCO_EXTENSIONS)
{
joinSupport = CMISJoinEnum.INNER_JOIN_SUPPORT;
}
CMISQueryParser parser = new CMISQueryParser(options, cmisDictionaryService, cmisMapping, joinSupport);
Query query = parser.parse(queryEngine.getQueryModelFactory());
CmisFunctionEvaluationContext functionContext = new CmisFunctionEvaluationContext();
functionContext.setCmisDictionaryService(cmisDictionaryService);
functionContext.setCmisPropertyService(cmisPropertyService);
functionContext.setNodeService(nodeService);
ResultSet lucene = queryEngine.executeQuery(query, query.getSource().getSelector(), options, functionContext);
QueryEngineResults results = queryEngine.executeQuery(query, options, functionContext);
Map<String, ResultSet> wrapped = new HashMap<String, ResultSet>();
wrapped.put(query.getSource().getSelector(), lucene);
Map<Set<String>, ResultSet> map = results.getResults();
for (Set<String> group : map.keySet())
{
ResultSet current = map.get(group);
for (String selector : group)
{
wrapped.put(selector, current);
}
}
CMISResultSet cmis = new CMISResultSetImpl(wrapped, options, nodeService, query, cmisDictionaryService, cmisPropertyService);
return cmis;
}