Merged CMIS063 to HEAD

17191: MOB-1332: Update Web Services TCK (Java/.NET) to 0.7
  17203: CMIS Query updates.
  17211: CMIS WS V1.0
  17213: Fix Apache CXF logging issues in exploded deploy mode.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@17263 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
David Caruana
2009-10-30 14:59:48 +00:00
parent c16a9548f0
commit e27a2b6f56
9 changed files with 1085 additions and 1032 deletions

View File

@@ -366,14 +366,6 @@ public class CMISQueryParser
case CMISParser.PRED_FTS:
String ftsExpression = predicateNode.getChild(0).getText();
FTSQueryParser ftsQueryParser = new FTSQueryParser();
if (options.getQueryMode() == CMISQueryMode.CMS_STRICT)
{
// set default AND
}
else
{
// set default from the options
}
Selector selector;
if (predicateNode.getChildCount() > 1)
{
@@ -395,8 +387,20 @@ public class CMISQueryParser
throw new CMISQueryException("A selector must be specified when there are two or more selectors");
}
}
return ftsQueryParser.buildFTS(ftsExpression.substring(1, ftsExpression.length() - 1), factory, functionEvaluationContext, selector, columns, Connective.OR,
Connective.OR, null);
Connective defaultConnective;
Connective defaultFieldConnective;
if (options.getQueryMode() == CMISQueryMode.CMS_STRICT)
{
defaultConnective = Connective.AND;
defaultFieldConnective = Connective.AND;
}
else
{
defaultConnective = options.getDefaultFTSConnective();
defaultFieldConnective = options.getDefaultFTSFieldConnective();
}
return ftsQueryParser.buildFTS(ftsExpression.substring(1, ftsExpression.length() - 1), factory, functionEvaluationContext, selector, columns, defaultConnective,
defaultFieldConnective, null);
case CMISParser.PRED_IN:
functionName = In.NAME;
function = factory.getFunction(functionName);
@@ -1106,6 +1110,14 @@ public class CMISQueryParser
throw new CMISQueryException("Type is not queryable " + tableName + " -> " + typeDef.getTypeId());
}
}
// check sub types all include in super type query
for(CMISTypeDefinition subType : typeDef.getSubTypes(true))
{
if(!subType.isIncludeInSuperTypeQuery())
{
throw new CMISQueryException("includeInSuperTypeQuery=falss is not support for "+tableName+ " descendant type "+subType.getQueryName());
}
}
return factory.createSelector(typeDef.getTypeId().getQName(), alias);
}
else
@@ -1137,6 +1149,14 @@ public class CMISQueryParser
throw new CMISQueryException("Type is not queryable " + tableName + " -> " + typeDef.getTypeId());
}
}
// check sub types all include in super type query
for(CMISTypeDefinition subType : typeDef.getSubTypes(true))
{
if(!subType.isIncludeInSuperTypeQuery())
{
throw new CMISQueryException("includeInSuperTypeQuery=falss is not support for "+tableName+ " descendant type "+subType.getQueryName());
}
}
Source lhs = factory.createSelector(typeDef.getTypeId().getQName(), alias);
List<CommonTree> list = (List<CommonTree>) (source.getChildren());

View File

@@ -49,6 +49,7 @@ import org.alfresco.repo.search.impl.parsers.CMISLexer;
import org.alfresco.repo.search.impl.parsers.CMISParser;
import org.alfresco.repo.search.impl.parsers.FTSQueryException;
import org.alfresco.repo.search.impl.querymodel.QueryModelException;
import org.alfresco.repo.search.impl.querymodel.QueryOptions.Connective;
import org.alfresco.service.cmr.repository.ContentData;
import org.alfresco.service.cmr.repository.ContentWriter;
import org.alfresco.service.cmr.repository.MLText;
@@ -994,6 +995,8 @@ public class QueryTest extends BaseCMISTest
testQuery("SELECT cmis:lastModificationDate FROM cmis:document WHERE ANY cmis:lastModificationDate IN ('" + sDate + "')", 10, false, "cmis:objectId", new String(), false);
testQuery("SELECT cmis:lastModificationDate FROM cmis:document WHERE ANY cmis:lastModificationDate NOT IN ('" + sDate + "')", 0, false, "cmis:objectId", new String(), false);
testQuery("SELECT cmis:lastModificationDate FROM cmis:document WHERE ANY cmis:lastModificationDate NOT IN ('" + sDate + "') order by cmis:lastModificationDate", 0, false, "cmis:objectId", new String(), false);
// using yesterday
date = Duration.subtract(date, new Duration("P1D"));
@@ -1091,7 +1094,8 @@ public class QueryTest extends BaseCMISTest
testQuery("SELECT cmis:lastModifiedBy FROM cmis:document WHERE ANY cmis:lastModifiedBy IN ('System')", 10, false, "cmis:objectId", new String(), false);
testQuery("SELECT cmis:lastModifiedBy FROM cmis:document WHERE ANY cmis:lastModifiedBy NOT IN ('System')", 0, false, "cmis:objectId", new String(), false);
testQuery("SELECT cmis:lastModifiedBy FROM cmis:document WHERE ANY cmis:lastModifiedBy NOT IN ('System') order by cmis:lastModifiedBy", 0, false, "cmis:objectId", new String(), false);
}
public void test_CREATION_DATE()
@@ -1147,6 +1151,8 @@ public class QueryTest extends BaseCMISTest
testQuery("SELECT cmis:creationDate FROM cmis:document WHERE ANY cmis:creationDate IN ('" + sDate + "')", 10, false, "cmis:objectId", new String(), false);
testQuery("SELECT cmis:creationDate FROM cmis:document WHERE ANY cmis:creationDate NOT IN ('" + sDate + "')", 0, false, "cmis:objectId", new String(), false);
testQuery("SELECT cmis:creationDate FROM cmis:document WHERE ANY cmis:creationDate NOT IN ('" + sDate + "') order by cmis:creationDate", 0, false, "cmis:objectId", new String(), false);
// using yesterday
date = Duration.subtract(date, new Duration("P1D"));
@@ -1244,6 +1250,8 @@ public class QueryTest extends BaseCMISTest
testQuery("SELECT cmis:createdBy FROM cmis:document WHERE ANY cmis:createdBy IN ('System')", 10, false, "cmis:objectId", new String(), false);
testQuery("SELECT cmis:createdBy FROM cmis:document WHERE ANY cmis:createdBy NOT IN ('System')", 0, false, "cmis:objectId", new String(), false);
testQuery("SELECT cmis:createdBy FROM cmis:document WHERE ANY cmis:createdBy IN ('System') order by cmis:createdBy", 10, false, "cmis:objectId", new String(), false);
}
public void test_OBJECT_TYPE_ID()
@@ -1837,6 +1845,31 @@ public class QueryTest extends BaseCMISTest
}
public void testFTSConnectives()
{
testQuery("SELECT * FROM cmis:document where contains('\"one\" and \"zebra\"')", 1, false, "cmis:objectId", new String(), false, CMISQueryMode.CMS_STRICT);
testQuery("SELECT * FROM cmis:document where contains('\"one\" or \"zebra\"')", 9, false, "cmis:objectId", new String(), false, CMISQueryMode.CMS_STRICT);
testQuery("SELECT * FROM cmis:document where contains('\"one\" \"zebra\"')", 1, false, "cmis:objectId", new String(), false, CMISQueryMode.CMS_STRICT);
testQuery("SELECT * FROM cmis:document where contains('\"one\" and \"zebra\"')", 1, false, "cmis:objectId", new String(), false, CMISQueryMode.CMS_WITH_ALFRESCO_EXTENSIONS);
testQuery("SELECT * FROM cmis:document where contains('\"one\" or \"zebra\"')", 9, false, "cmis:objectId", new String(), false, CMISQueryMode.CMS_WITH_ALFRESCO_EXTENSIONS);
testQuery("SELECT * FROM cmis:document where contains('\"one\" \"zebra\"')", 1, false, "cmis:objectId", new String(), false, CMISQueryMode.CMS_WITH_ALFRESCO_EXTENSIONS);
CMISQueryOptions options = new CMISQueryOptions("SELECT * FROM cmis:document where contains('\"one\" \"zebra\"')", rootNodeRef.getStoreRef());
options.setDefaultFTSConnective(Connective.OR);
options.setDefaultFTSFieldConnective(Connective.OR);
CMISResultSet rs = cmisQueryService.query(options);
assertEquals(1, rs.length());
rs.close();
options = new CMISQueryOptions("SELECT * FROM cmis:document where contains('\"one\" \"zebra\"')", rootNodeRef.getStoreRef());
options.setDefaultFTSConnective(Connective.OR);
options.setDefaultFTSFieldConnective(Connective.OR);
options.setQueryMode(CMISQueryMode.CMS_WITH_ALFRESCO_EXTENSIONS);
rs = cmisQueryService.query(options);
assertEquals(9, rs.length());
rs.close();
}
private void doPage(List<String> expected, int skip, int max)
{
CMISQueryOptions options = new CMISQueryOptions("SELECT * FROM cmis:folder", rootNodeRef.getStoreRef());