diff --git a/.externalToolBuilders/JibX.launch b/.externalToolBuilders/JibX.launch index a5578dd881..7ef90b1e04 100644 --- a/.externalToolBuilders/JibX.launch +++ b/.externalToolBuilders/JibX.launch @@ -21,7 +21,7 @@ - + diff --git a/config/alfresco/model/cmisModel.xml b/config/alfresco/model/cmisModel.xml index ed7eea714c..3aa34ab615 100644 --- a/config/alfresco/model/cmisModel.xml +++ b/config/alfresco/model/cmisModel.xml @@ -243,6 +243,42 @@ cmis:Core + + + Policy + Policy Type + + + Policy Name + The name of the policy + d:text + true + true + false + + + + Policy Text + The policy text + d:text + true + true + false + + + + + cmis:Core + + + + + Aspect Policy + Aspect Policy Type + cmis:Policy + + + diff --git a/source/java/org/alfresco/cmis/dictionary/BaseCMISTest.java b/source/java/org/alfresco/cmis/dictionary/BaseCMISTest.java index cb5ebf595e..174b1d0faf 100644 --- a/source/java/org/alfresco/cmis/dictionary/BaseCMISTest.java +++ b/source/java/org/alfresco/cmis/dictionary/BaseCMISTest.java @@ -40,6 +40,7 @@ import org.alfresco.repo.security.authentication.MutableAuthenticationDao; import org.alfresco.service.ServiceRegistry; import org.alfresco.service.cmr.dictionary.DictionaryService; import org.alfresco.service.cmr.model.FileFolderService; +import org.alfresco.service.cmr.repository.ContentService; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeService; import org.alfresco.service.cmr.repository.StoreRef; @@ -95,6 +96,8 @@ public abstract class BaseCMISTest extends TestCase protected SearchService searchService; + protected ContentService contentService; + public void setUp() throws Exception { serviceRegistry = (ServiceRegistry) ctx.getBean("ServiceRegistry"); @@ -114,6 +117,8 @@ public abstract class BaseCMISTest extends TestCase searchService = (SearchService) ctx.getBean("searchService"); + contentService = (ContentService) ctx.getBean("contentService"); + authenticationService = (AuthenticationService) ctx.getBean("authenticationService"); authenticationDAO = (MutableAuthenticationDao) ctx.getBean("authenticationDao"); @@ -121,7 +126,7 @@ public abstract class BaseCMISTest extends TestCase testTX.begin(); this.authenticationComponent.setSystemUserAsCurrentUser(); - String storeName = "CMISTest-" + getName() + "-" + (new Date().getTime()); + String storeName = "CMISTest-" + getStoreName() + "-" + (new Date().getTime()); StoreRef storeRef = nodeService.createStore(StoreRef.PROTOCOL_WORKSPACE, storeName); rootNodeRef = nodeService.getRootNode(storeRef); @@ -131,6 +136,15 @@ public abstract class BaseCMISTest extends TestCase } authenticationService.createAuthentication("cmis", "cmis".toCharArray()); } + + private String getStoreName() + { + String testName = getName(); + testName = testName.replace("_", "-"); + testName = testName.replace("%", "-"); + return testName; + + } protected void runAs(String userName) { diff --git a/source/java/org/alfresco/cmis/dictionary/CMISDictionaryService.java b/source/java/org/alfresco/cmis/dictionary/CMISDictionaryService.java index b8bc67ff3b..d513623e11 100644 --- a/source/java/org/alfresco/cmis/dictionary/CMISDictionaryService.java +++ b/source/java/org/alfresco/cmis/dictionary/CMISDictionaryService.java @@ -44,9 +44,9 @@ import org.alfresco.service.namespace.QName; public class CMISDictionaryService { private CMISMapping cmisMapping; - + private DictionaryService dictionaryService; - + private boolean strict = true; /** @@ -58,15 +58,15 @@ public class CMISDictionaryService { this.cmisMapping = cmisMapping; } - + /** - * @return cmis mapping service + * @return cmis mapping service */ public CMISMapping getCMISMapping() { return cmisMapping; } - + /** * Set the dictionary Service * @@ -82,11 +82,11 @@ public class CMISDictionaryService * * @return dictionaryService */ - /*package*/ DictionaryService getDictionaryService() + /* package */DictionaryService getDictionaryService() { return this.dictionaryService; } - + /** * Is the service strict (CMIS types only) * @@ -145,6 +145,8 @@ public class CMISDictionaryService { answer.add(cmisMapping.getCmisTypeId(CMISScope.RELATIONSHIP, typeQName)); } + // TODO: Policy + // For now, policies are not reported } for (QName associationName : alfrescoAssociationQNames) @@ -162,7 +164,8 @@ public class CMISDictionaryService * Gets all the object type ids within a type hierarchy * * @param typeId - * @param descendants true => include all descendants, false => children only + * @param descendants + * true => include all descendants, false => children only * @return */ public Collection getChildTypeIds(CMISTypeId typeId, boolean descendants) @@ -218,11 +221,13 @@ public class CMISDictionaryService { return Collections.emptySet(); } + case POLICY: + // TODO: Policy default: return Collections.emptySet(); } } - + /** * Get the object type definition TODO: Note there can be name collisions between types and associations. e.g. * app:configurations Currently clashing types will give inconsistent behaviour @@ -262,11 +267,13 @@ public class CMISDictionaryService { return null; } + case POLICY: + // TODO: Policy default: return null; } } - + /** * Get all the property definitions for a type * @@ -333,6 +340,39 @@ public class CMISDictionaryService } } break; + case POLICY: + AspectDefinition aspectDefinition = dictionaryService.getAspect(typeId.getQName()); + if (aspectDefinition != null) + { + + for (QName qname : aspectDefinition.getProperties().keySet()) + { + if (cmisMapping.getPropertyType(qname) != null) + { + CMISPropertyDefinition cmisPropDefinition = new CMISPropertyDefinition(this, qname, aspectDefinition.getName()); + properties.put(cmisPropDefinition.getPropertyName(), cmisPropDefinition); + } + } + for (AspectDefinition aspect : aspectDefinition.getDefaultAspects()) + { + for (QName qname : aspect.getProperties().keySet()) + { + if (cmisMapping.getPropertyType(qname) != null) + { + CMISPropertyDefinition cmisPropDefinition = new CMISPropertyDefinition(this, qname, aspectDefinition.getName()); + properties.put(cmisPropDefinition.getPropertyName(), cmisPropDefinition); + } + } + } + + // Add CMIS properties if required + if (!cmisMapping.isCmisCoreType(typeId.getQName())) + { + properties.putAll(getPropertyDefinitions(typeId.getRootTypeId())); + } + + } + break; case UNKNOWN: default: break; diff --git a/source/java/org/alfresco/cmis/dictionary/CMISMapping.java b/source/java/org/alfresco/cmis/dictionary/CMISMapping.java index e6693e60ac..ada23cf43e 100644 --- a/source/java/org/alfresco/cmis/dictionary/CMISMapping.java +++ b/source/java/org/alfresco/cmis/dictionary/CMISMapping.java @@ -31,6 +31,7 @@ import org.alfresco.cmis.CMISPropertyTypeEnum; import org.alfresco.error.AlfrescoRuntimeException; import org.alfresco.model.ContentModel; import org.alfresco.service.cmr.dictionary.AssociationDefinition; +import org.alfresco.service.cmr.dictionary.ClassDefinition; import org.alfresco.service.cmr.dictionary.DataTypeDefinition; import org.alfresco.service.cmr.dictionary.DictionaryService; import org.alfresco.service.cmr.dictionary.PropertyDefinition; @@ -75,6 +76,11 @@ public class CMISMapping */ public static String RELATIONSHIP_OBJECT_TYPE = "Relationship"; + /** + * Type Id for CMIS Policies, from the spec. + */ + public static String POLICY_OBJECT_TYPE = "Policy"; + /** * QName for CMIS documents in the Alfresco CMIS model. */ @@ -90,14 +96,18 @@ public class CMISMapping */ public static QName RELATIONSHIP_QNAME = QName.createQName(CMIS_MODEL_URI, RELATIONSHIP_OBJECT_TYPE); + public static QName POLICY_QNAME = QName.createQName(CMIS_MODEL_URI, POLICY_OBJECT_TYPE); + // TODO: spec issue - objectTypeEnum is lower cased - object type ids are repository specific in spec - + public static CMISTypeId DOCUMENT_TYPE_ID = new CMISTypeId(CMISScope.DOCUMENT, DOCUMENT_QNAME, DOCUMENT_OBJECT_TYPE.toLowerCase()); public static CMISTypeId FOLDER_TYPE_ID = new CMISTypeId(CMISScope.FOLDER, FOLDER_QNAME, FOLDER_OBJECT_TYPE.toLowerCase()); public static CMISTypeId RELATIONSHIP_TYPE_ID = new CMISTypeId(CMISScope.RELATIONSHIP, RELATIONSHIP_QNAME, RELATIONSHIP_OBJECT_TYPE.toLowerCase()); + public static CMISTypeId POLICY_TYPE_ID = new CMISTypeId(CMISScope.POLICY, POLICY_QNAME, POLICY_OBJECT_TYPE.toLowerCase()); + // CMIS properties public static String PROP_OBJECT_ID = "ObjectId"; @@ -156,6 +166,10 @@ public class CMISMapping public static String PROP_TARGET_ID = "TargetId"; + // QNames + + public static QName PROP_OBJECT_ID_QNAME = QName.createQName(CMIS_MODEL_URI, PROP_OBJECT_ID); + // Mappings // - no entry means no mapping and pass through as is @@ -175,10 +189,12 @@ public class CMISMapping qNameToCmisTypeId.put(DOCUMENT_QNAME, DOCUMENT_TYPE_ID); qNameToCmisTypeId.put(FOLDER_QNAME, FOLDER_TYPE_ID); qNameToCmisTypeId.put(RELATIONSHIP_QNAME, RELATIONSHIP_TYPE_ID); + qNameToCmisTypeId.put(POLICY_QNAME, POLICY_TYPE_ID); cmisToAlfrecsoTypes.put(DOCUMENT_QNAME, ContentModel.TYPE_CONTENT); cmisToAlfrecsoTypes.put(FOLDER_QNAME, ContentModel.TYPE_FOLDER); cmisToAlfrecsoTypes.put(RELATIONSHIP_QNAME, null); + cmisToAlfrecsoTypes.put(POLICY_QNAME, null); alfrescoToCmisTypes.put(ContentModel.TYPE_CONTENT, DOCUMENT_QNAME); alfrescoToCmisTypes.put(ContentModel.TYPE_FOLDER, FOLDER_QNAME); @@ -280,7 +296,10 @@ public class CMISMapping { return RELATIONSHIP_TYPE_ID; } - // TODO: Policy root object type + else if (typeId.equalsIgnoreCase(POLICY_TYPE_ID.getTypeId())) + { + return POLICY_TYPE_ID; + } // Is it an Alfresco type id? if (typeId.length() < 4 || typeId.charAt(1) != '/') @@ -347,7 +366,15 @@ public class CMISMapping } else { - return null; + ClassDefinition classDef = dictionaryService.getClass(typeQName); + if (classDef.isAspect()) + { + return getCmisTypeId(CMISScope.POLICY, getCmisType(typeQName)); + } + else + { + return null; + } } } @@ -395,6 +422,8 @@ public class CMISMapping */ public boolean isValidCmisType(QName typeQName) { + // TODO: Policy: Include aspects types as policies + // TODO: Policy: Add isValidCmispolicy(QName typeQName) return isValidCmisFolder(typeQName) || isValidCmisDocument(typeQName) || isValidCmisRelationship(typeQName); } @@ -530,7 +559,7 @@ public class CMISMapping } return typeQName; } - + /** * Given a CMIS model type map it to the appropriate Alfresco type. * @@ -559,6 +588,21 @@ public class CMISMapping return buildPrefixEncodedString(propertyQName, false); } + public CMISTypeId getCmisTypeForProperty(QName propertyQName) + { + PropertyDefinition pDef = dictionaryService.getProperty(propertyQName); + if (pDef != null) + { + QName typeQName = pDef.getContainerClass().getName(); + return getCmisTypeId(typeQName); + } + else + { + return null; + } + + } + /** * Get the CMIS property type for a property * @@ -615,6 +659,23 @@ public class CMISMapping // Find prefix and property name - in upper case int split = cmisPropertyName.indexOf('_'); + + // CMIS case insensitive hunt - no prefix + if (split == -1) + { + for (QName qname : dictionaryService.getAllProperties(null)) + { + if (qname.getNamespaceURI().equals(CMIS_MODEL_URI)) + { + if (qname.getLocalName().equalsIgnoreCase(cmisPropertyName)) + { + return qname; + } + } + } + return null; + } + String prefix = cmisPropertyName.substring(0, split); String localName = cmisPropertyName.substring(split + 1); @@ -671,10 +732,18 @@ public class CMISMapping { return null; } + else if (tableName.equalsIgnoreCase(POLICY_TYPE_ID.getTypeId())) + { + return null; + } // Find prefix and property name - in upper case int split = tableName.indexOf('_'); + if (split == -1) + { + return null; + } String prefix = tableName.substring(0, split); String localName = tableName.substring(split + 1); diff --git a/source/java/org/alfresco/cmis/dictionary/CMISTypeDefinition.java b/source/java/org/alfresco/cmis/dictionary/CMISTypeDefinition.java index 26b0211edf..b6377bedd4 100644 --- a/source/java/org/alfresco/cmis/dictionary/CMISTypeDefinition.java +++ b/source/java/org/alfresco/cmis/dictionary/CMISTypeDefinition.java @@ -35,6 +35,7 @@ import org.alfresco.cmis.CMISContentStreamAllowedEnum; import org.alfresco.model.ContentModel; import org.alfresco.service.cmr.dictionary.AspectDefinition; import org.alfresco.service.cmr.dictionary.AssociationDefinition; +import org.alfresco.service.cmr.dictionary.ClassDefinition; import org.alfresco.service.cmr.dictionary.DictionaryService; import org.alfresco.service.cmr.dictionary.TypeDefinition; import org.alfresco.service.namespace.QName; @@ -71,6 +72,7 @@ public class CMISTypeDefinition implements Serializable private boolean queryable; + // TODO: Policy - report controllable true as policies can be applied private boolean controllable; private boolean versionable; @@ -161,7 +163,7 @@ public class CMISTypeDefinition implements Serializable break; case DOCUMENT: case FOLDER: - TypeDefinition typeDefinition = dictionaryService.getType(typeId.getQName()); + ClassDefinition typeDefinition = dictionaryService.getType(typeId.getQName()); if (typeDefinition != null) { objectTypeId = typeId; @@ -227,6 +229,25 @@ public class CMISTypeDefinition implements Serializable } } + break; + case POLICY: + ClassDefinition classDefinition = dictionaryService.getType(typeId.getQName()); + if (classDefinition != null) + { + objectTypeId = typeId; + objectTypeQueryName = cmisMapping.getQueryName(typeId.getQName()); + displayName = (classDefinition.getTitle() != null) ? classDefinition.getTitle() : typeId.getTypeId(); + parentTypeId = CMISMapping.POLICY_TYPE_ID; + rootTypeQueryName = cmisMapping.getQueryName(CMISMapping.POLICY_QNAME); + description = classDefinition.getDescription(); + creatable = false; + fileable = false; + queryable = false; + controllable = false; + versionable = false; + includedInSupertypeQuery = true; + contentStreamAllowed = CMISContentStreamAllowedEnum.NOT_ALLOWED; + } break; case UNKNOWN: default: diff --git a/source/java/org/alfresco/cmis/dictionary/CMISTypeId.java b/source/java/org/alfresco/cmis/dictionary/CMISTypeId.java index d8928a618e..34dee0ab68 100644 --- a/source/java/org/alfresco/cmis/dictionary/CMISTypeId.java +++ b/source/java/org/alfresco/cmis/dictionary/CMISTypeId.java @@ -95,6 +95,8 @@ public class CMISTypeId implements Serializable return CMISMapping.FOLDER_TYPE_ID; case RELATIONSHIP: return CMISMapping.RELATIONSHIP_TYPE_ID; + case POLICY: + return CMISMapping.POLICY_TYPE_ID; case UNKNOWN: default: return null; diff --git a/source/java/org/alfresco/cmis/search/CMISQueryOptions.java b/source/java/org/alfresco/cmis/search/CMISQueryOptions.java index 97afc94ba3..f644ae7791 100644 --- a/source/java/org/alfresco/cmis/search/CMISQueryOptions.java +++ b/source/java/org/alfresco/cmis/search/CMISQueryOptions.java @@ -37,8 +37,13 @@ import org.alfresco.service.cmr.repository.StoreRef; */ public class CMISQueryOptions extends QueryOptions { + public enum CMISQueryMode + { + CMS_STRICT, CMS_WITH_ALFRESCO_EXTENSIONS ; + } + - private CMISQueryMode queryMode = CMISQueryMode.STRICT; + private CMISQueryMode queryMode = CMISQueryMode.CMS_STRICT; /** * Create a CMISQueryOptions instance with the default options other than the query and store ref. @@ -86,3 +91,5 @@ public class CMISQueryOptions extends QueryOptions this.queryMode = queryMode; } } + + diff --git a/source/java/org/alfresco/cmis/search/CMISResultSet.java b/source/java/org/alfresco/cmis/search/CMISResultSet.java index 50765df881..62dede4003 100644 --- a/source/java/org/alfresco/cmis/search/CMISResultSet.java +++ b/source/java/org/alfresco/cmis/search/CMISResultSet.java @@ -41,7 +41,7 @@ public interface CMISResultSet extends Iterable /** * Get the start point for this results set in the overall - * set of rows that match the query - this will be equals to the skip count + * set of rows that match the query - this will be equal to the skip count * set when executing the query. * @return */ diff --git a/source/java/org/alfresco/cmis/search/CMISResultSetImpl.java b/source/java/org/alfresco/cmis/search/CMISResultSetImpl.java index 2deafc697c..1b5de6bfb1 100644 --- a/source/java/org/alfresco/cmis/search/CMISResultSetImpl.java +++ b/source/java/org/alfresco/cmis/search/CMISResultSetImpl.java @@ -26,8 +26,10 @@ package org.alfresco.cmis.search; import java.io.Serializable; import java.util.HashMap; +import java.util.HashSet; import java.util.Iterator; import java.util.Map; +import java.util.Set; import org.alfresco.cmis.dictionary.CMISDictionaryService; import org.alfresco.cmis.property.CMISPropertyService; @@ -36,6 +38,7 @@ import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeService; import org.alfresco.service.cmr.search.LimitBy; import org.alfresco.service.cmr.search.ResultSet; +import org.springframework.web.servlet.tags.form.OptionTag; /** * @author andyh @@ -49,14 +52,15 @@ public class CMISResultSetImpl implements CMISResultSet, Serializable CMISQueryOptions options; NodeService nodeService; - + Query query; - + CMISDictionaryService cmisDictionaryService; - + CMISPropertyService cmisPropertyService; - public CMISResultSetImpl(Map wrapped, CMISQueryOptions options, NodeService nodeService, Query query, CMISDictionaryService cmisDictionaryService, CMISPropertyService cmisPropertyService) + public CMISResultSetImpl(Map wrapped, CMISQueryOptions options, NodeService nodeService, Query query, CMISDictionaryService cmisDictionaryService, + CMISPropertyService cmisPropertyService) { this.wrapped = wrapped; this.options = options; @@ -73,9 +77,15 @@ public class CMISResultSetImpl implements CMISResultSet, Serializable */ public void close() { + // results sets can be used for more than one selector so we need to keep track of what we have closed + Set closed = new HashSet(); for (ResultSet resultSet : wrapped.values()) { - resultSet.close(); + if (!closed.contains(resultSet)) + { + resultSet.close(); + closed.add(resultSet); + } } } @@ -108,12 +118,19 @@ public class CMISResultSetImpl implements CMISResultSet, Serializable { for (ResultSet resultSet : wrapped.values()) { - if(resultSet.getResultSetMetaData().getLimitedBy() != LimitBy.UNLIMITED) + if (resultSet.getResultSetMetaData().getLimitedBy() != LimitBy.UNLIMITED) { return true; } + else + { + if(resultSet.length() - getStart() > getLength() ) + { + return true; + } + } } - return false; + return false; } /* @@ -125,7 +142,16 @@ public class CMISResultSetImpl implements CMISResultSet, Serializable { for (ResultSet resultSet : wrapped.values()) { - return resultSet.length(); + int max = options.getMaxItems(); + int skip = options.getSkipCount(); + if((max >= 0) && (max < (resultSet.length() - skip))) + { + return options.getMaxItems(); + } + else + { + return resultSet.length() - skip; + } } throw new IllegalStateException(); } @@ -156,7 +182,7 @@ public class CMISResultSetImpl implements CMISResultSet, Serializable for (String selector : wrapped.keySet()) { ResultSet rs = wrapped.get(selector); - refs.put(selector, rs.getNodeRef(i)); + refs.put(selector, rs.getNodeRef(getStart() + i)); } return refs; } @@ -167,7 +193,7 @@ public class CMISResultSetImpl implements CMISResultSet, Serializable for (String selector : wrapped.keySet()) { ResultSet rs = wrapped.get(selector); - scores.put(selector, Float.valueOf(rs.getScore(i))); + scores.put(selector, Float.valueOf(rs.getScore(getStart() + i))); } return scores; } diff --git a/source/java/org/alfresco/cmis/search/QueryTest.java b/source/java/org/alfresco/cmis/search/QueryTest.java index 9d64936e5d..f2192e57e9 100644 --- a/source/java/org/alfresco/cmis/search/QueryTest.java +++ b/source/java/org/alfresco/cmis/search/QueryTest.java @@ -26,30 +26,275 @@ package org.alfresco.cmis.search; import java.io.Serializable; import java.text.SimpleDateFormat; +import java.util.ArrayList; import java.util.Calendar; import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; import org.alfresco.cmis.dictionary.BaseCMISTest; import org.alfresco.cmis.dictionary.CMISMapping; +import org.alfresco.cmis.search.CMISQueryOptions.CMISQueryMode; +import org.alfresco.model.ContentModel; +import org.alfresco.repo.search.impl.parsers.CMISLexer; +import org.alfresco.repo.search.impl.parsers.CMISParser; import org.alfresco.repo.search.impl.querymodel.QueryModelException; +import org.alfresco.service.cmr.repository.ContentData; +import org.alfresco.service.cmr.repository.ContentWriter; +import org.alfresco.service.cmr.repository.MLText; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter; import org.alfresco.service.cmr.repository.datatype.Duration; +import org.alfresco.service.namespace.QName; import org.alfresco.util.CachingDateFormat; +import org.antlr.runtime.ANTLRStringStream; +import org.antlr.runtime.CharStream; +import org.antlr.runtime.CommonTokenStream; +import org.antlr.runtime.RecognitionException; +import org.antlr.runtime.tree.CommonTree; /** * @author andyh */ public class QueryTest extends BaseCMISTest { - @SuppressWarnings("unchecked") + private int file_count = 0; + + private int folder_count = 0; + + private NodeRef f0; + + @Override + public void setUp() throws Exception + { + super.setUp(); + + f0 = nodeService.createNode(rootNodeRef, ContentModel.ASSOC_CHILDREN, QName.createQName("cm", "Folder 0", namespaceService), ContentModel.TYPE_FOLDER).getChildRef(); + nodeService.setProperty(f0, ContentModel.PROP_NAME, "Folder 0"); + folder_count++; + + NodeRef f1 = nodeService.createNode(rootNodeRef, ContentModel.ASSOC_CHILDREN, QName.createQName("cm", "Folder 1", namespaceService), ContentModel.TYPE_FOLDER) + .getChildRef(); + nodeService.setProperty(f1, ContentModel.PROP_NAME, "Folder 1"); + folder_count++; + + NodeRef f2 = nodeService.createNode(rootNodeRef, ContentModel.ASSOC_CHILDREN, QName.createQName("cm", "Folder 2", namespaceService), ContentModel.TYPE_FOLDER) + .getChildRef(); + nodeService.setProperty(f2, ContentModel.PROP_NAME, "Folder 2"); + folder_count++; + + NodeRef f3 = nodeService.createNode(rootNodeRef, ContentModel.ASSOC_CHILDREN, QName.createQName("cm", "Folder 3", namespaceService), ContentModel.TYPE_FOLDER) + .getChildRef(); + nodeService.setProperty(f3, ContentModel.PROP_NAME, "Folder 3"); + folder_count++; + + NodeRef f4 = nodeService.createNode(f0, ContentModel.ASSOC_CHILDREN, QName.createQName("cm", "Folder 4", namespaceService), ContentModel.TYPE_FOLDER).getChildRef(); + nodeService.setProperty(f4, ContentModel.PROP_NAME, "Folder 4"); + folder_count++; + + NodeRef f5 = nodeService.createNode(f0, ContentModel.ASSOC_CHILDREN, QName.createQName("cm", "Folder 5", namespaceService), ContentModel.TYPE_FOLDER).getChildRef(); + nodeService.setProperty(f5, ContentModel.PROP_NAME, "Folder 5"); + folder_count++; + + NodeRef f6 = nodeService.createNode(f5, ContentModel.ASSOC_CHILDREN, QName.createQName("cm", "Folder 6", namespaceService), ContentModel.TYPE_FOLDER).getChildRef(); + nodeService.setProperty(f6, ContentModel.PROP_NAME, "Folder 6"); + folder_count++; + + NodeRef f7 = nodeService.createNode(f6, ContentModel.ASSOC_CHILDREN, QName.createQName("cm", "Folder 7", namespaceService), ContentModel.TYPE_FOLDER).getChildRef(); + nodeService.setProperty(f7, ContentModel.PROP_NAME, "Folder 7"); + folder_count++; + + NodeRef f8 = nodeService.createNode(f7, ContentModel.ASSOC_CHILDREN, QName.createQName("cm", "Folder 8", namespaceService), ContentModel.TYPE_FOLDER).getChildRef(); + nodeService.setProperty(f8, ContentModel.PROP_NAME, "Folder 8"); + folder_count++; + + NodeRef f9 = nodeService.createNode(f8, ContentModel.ASSOC_CHILDREN, QName.createQName("cm", "Folder 9", namespaceService), ContentModel.TYPE_FOLDER).getChildRef(); + nodeService.setProperty(f9, ContentModel.PROP_NAME, "Folder 9"); + folder_count++; + + Map properties0 = new HashMap(); + MLText desc0 = new MLText(); + desc0.addValue(Locale.ENGLISH, "Alfresco tutorial"); + desc0.addValue(Locale.US, "Alfresco tutorial"); + properties0.put(ContentModel.PROP_CONTENT, new ContentData(null, "text/plain", 0L, "UTF-8", Locale.UK)); + properties0.put(ContentModel.PROP_DESCRIPTION, desc0); + properties0.put(ContentModel.PROP_TITLE, desc0); + properties0.put(ContentModel.PROP_NAME, "Alfresco Tutorial"); + properties0.put(ContentModel.PROP_CREATED, new Date()); + NodeRef c0 = nodeService + .createNode(f0, ContentModel.ASSOC_CHILDREN, QName.createQName("cm", "Alfresco Tutorial", namespaceService), ContentModel.TYPE_CONTENT, properties0).getChildRef(); + ContentWriter writer0 = contentService.getWriter(c0, ContentModel.PROP_CONTENT, true); + writer0.setEncoding("UTF-8"); + writer0.putContent("The quick brown fox jumped over the lazy dog and ate the Alfresco Tutorial, in pdf format, along with the following stop words; a an and are" + + " as at be but by for if in into is it no not of on or such that the their then there these they this to was will with: " + + " and random charcters \u00E0\u00EA\u00EE\u00F0\u00F1\u00F6\u00FB\u00FF"); + nodeService.addAspect(c0, ContentModel.ASPECT_TITLED, null); + nodeService.addAspect(c0, ContentModel.ASPECT_OWNABLE, null); + nodeService.setProperty(c0, ContentModel.PROP_OWNER, "andy"); + file_count++; + + Map properties1 = new HashMap(); + MLText desc1 = new MLText(); + desc1.addValue(Locale.ENGLISH, "One"); + desc1.addValue(Locale.US, "One"); + properties1.put(ContentModel.PROP_CONTENT, new ContentData(null, "text/plain", 0L, "UTF-8", Locale.UK)); + properties1.put(ContentModel.PROP_DESCRIPTION, desc1); + properties1.put(ContentModel.PROP_TITLE, desc1); + properties1.put(ContentModel.PROP_CREATED, new Date()); + NodeRef c1 = nodeService.createNode(f1, ContentModel.ASSOC_CHILDREN, QName.createQName("cm", "One", namespaceService), ContentModel.TYPE_CONTENT, properties1) + .getChildRef(); + ContentWriter writer1 = contentService.getWriter(c1, ContentModel.PROP_CONTENT, true); + writer1.setEncoding("UTF-8"); + writer1.putContent("One Zebra Apple"); + nodeService.addAspect(c1, ContentModel.ASPECT_TITLED, null); + file_count++; + + Map properties2 = new HashMap(); + MLText desc2 = new MLText(); + desc2.addValue(Locale.ENGLISH, "Two"); + desc2.addValue(Locale.US, "Two"); + properties2.put(ContentModel.PROP_CONTENT, new ContentData(null, "text/plain", 0L, "UTF-8", Locale.UK)); + properties2.put(ContentModel.PROP_DESCRIPTION, desc2); + properties2.put(ContentModel.PROP_TITLE, desc2); + properties2.put(ContentModel.PROP_CREATED, new Date()); + NodeRef c2 = nodeService.createNode(f2, ContentModel.ASSOC_CHILDREN, QName.createQName("cm", "Two", namespaceService), ContentModel.TYPE_CONTENT, properties2) + .getChildRef(); + ContentWriter writer2 = contentService.getWriter(c2, ContentModel.PROP_CONTENT, true); + writer2.setEncoding("UTF-8"); + writer2.putContent("Two Zebra Banana"); + nodeService.addAspect(c2, ContentModel.ASPECT_TITLED, null); + file_count++; + + Map properties3 = new HashMap(); + MLText desc3 = new MLText(); + desc3.addValue(Locale.ENGLISH, "Three"); + desc3.addValue(Locale.US, "Three"); + properties3.put(ContentModel.PROP_CONTENT, new ContentData(null, "text/plain", 0L, "UTF-8", Locale.UK)); + properties3.put(ContentModel.PROP_DESCRIPTION, desc3); + properties3.put(ContentModel.PROP_TITLE, desc3); + properties3.put(ContentModel.PROP_CREATED, new Date()); + NodeRef c3 = nodeService.createNode(f3, ContentModel.ASSOC_CHILDREN, QName.createQName("cm", "Three", namespaceService), ContentModel.TYPE_CONTENT, properties3) + .getChildRef(); + ContentWriter writer3 = contentService.getWriter(c3, ContentModel.PROP_CONTENT, true); + writer3.setEncoding("UTF-8"); + writer3.putContent("Three Zebra Clementine"); + nodeService.addAspect(c3, ContentModel.ASPECT_TITLED, null); + file_count++; + + Map properties4 = new HashMap(); + MLText desc4 = new MLText(); + desc4.addValue(Locale.ENGLISH, "Four"); + desc4.addValue(Locale.US, "Four"); + properties4.put(ContentModel.PROP_CONTENT, new ContentData(null, "text/plain", 0L, "UTF-8", Locale.UK)); + properties4.put(ContentModel.PROP_DESCRIPTION, desc4); + properties4.put(ContentModel.PROP_TITLE, desc4); + properties4.put(ContentModel.PROP_CREATED, new Date()); + NodeRef c4 = nodeService.createNode(f4, ContentModel.ASSOC_CHILDREN, QName.createQName("cm", "Four", namespaceService), ContentModel.TYPE_CONTENT, properties4) + .getChildRef(); + ContentWriter writer4 = contentService.getWriter(c4, ContentModel.PROP_CONTENT, true); + writer4.setEncoding("UTF-8"); + writer4.putContent("Four zebra durian"); + nodeService.addAspect(c4, ContentModel.ASPECT_TITLED, null); + file_count++; + + Map properties5 = new HashMap(); + MLText desc5 = new MLText(); + desc5.addValue(Locale.ENGLISH, "Five"); + desc5.addValue(Locale.US, "Five"); + properties5.put(ContentModel.PROP_CONTENT, new ContentData(null, "text/plain", 0L, "UTF-8", Locale.UK)); + properties5.put(ContentModel.PROP_DESCRIPTION, desc5); + properties5.put(ContentModel.PROP_TITLE, desc5); + properties5.put(ContentModel.PROP_CREATED, new Date()); + NodeRef c5 = nodeService.createNode(f5, ContentModel.ASSOC_CHILDREN, QName.createQName("cm", "Five", namespaceService), ContentModel.TYPE_CONTENT, properties5) + .getChildRef(); + ContentWriter writer5 = contentService.getWriter(c5, ContentModel.PROP_CONTENT, true); + writer5.setEncoding("UTF-8"); + writer5.putContent("Five zebra Ebury"); + nodeService.addAspect(c5, ContentModel.ASPECT_TITLED, null); + file_count++; + + Map properties6 = new HashMap(); + MLText desc6 = new MLText(); + desc6.addValue(Locale.ENGLISH, "Six"); + desc6.addValue(Locale.US, "Six"); + properties6.put(ContentModel.PROP_CONTENT, new ContentData(null, "text/plain", 0L, "UTF-8", Locale.UK)); + properties6.put(ContentModel.PROP_DESCRIPTION, desc6); + properties6.put(ContentModel.PROP_TITLE, desc6); + properties6.put(ContentModel.PROP_CREATED, new Date()); + NodeRef c6 = nodeService.createNode(f6, ContentModel.ASSOC_CHILDREN, QName.createQName("cm", "Six", namespaceService), ContentModel.TYPE_CONTENT, properties6) + .getChildRef(); + ContentWriter writer6 = contentService.getWriter(c6, ContentModel.PROP_CONTENT, true); + writer6.setEncoding("UTF-8"); + writer6.putContent("Six zebra fig"); + nodeService.addAspect(c6, ContentModel.ASPECT_TITLED, null); + file_count++; + + Map properties7 = new HashMap(); + MLText desc7 = new MLText(); + desc7.addValue(Locale.ENGLISH, "Seven"); + desc7.addValue(Locale.US, "Seven"); + properties7.put(ContentModel.PROP_CONTENT, new ContentData(null, "text/plain", 0L, "UTF-8", Locale.UK)); + properties7.put(ContentModel.PROP_DESCRIPTION, desc7); + properties7.put(ContentModel.PROP_TITLE, desc7); + properties7.put(ContentModel.PROP_CREATED, new Date()); + NodeRef c7 = nodeService.createNode(f7, ContentModel.ASSOC_CHILDREN, QName.createQName("cm", "Seven", namespaceService), ContentModel.TYPE_CONTENT, properties7) + .getChildRef(); + ContentWriter writer7 = contentService.getWriter(c7, ContentModel.PROP_CONTENT, true); + writer7.setEncoding("UTF-8"); + writer7.putContent("Seven zebra grapefruit"); + nodeService.addAspect(c7, ContentModel.ASPECT_TITLED, null); + file_count++; + + Map properties8 = new HashMap(); + MLText desc8 = new MLText(); + desc8.addValue(Locale.ENGLISH, "Eight"); + desc8.addValue(Locale.US, "Eight"); + properties8.put(ContentModel.PROP_CONTENT, new ContentData(null, "text/plain", 0L, "UTF-8", Locale.UK)); + properties8.put(ContentModel.PROP_DESCRIPTION, desc8); + properties8.put(ContentModel.PROP_TITLE, desc8); + properties8.put(ContentModel.PROP_CREATED, new Date()); + NodeRef c8 = nodeService.createNode(f8, ContentModel.ASSOC_CHILDREN, QName.createQName("cm", "Eight", namespaceService), ContentModel.TYPE_CONTENT, properties8) + .getChildRef(); + ContentWriter writer8 = contentService.getWriter(c8, ContentModel.PROP_CONTENT, true); + writer8.setEncoding("UTF-8"); + writer8.putContent("Eight zebra jackfruit"); + nodeService.addAspect(c8, ContentModel.ASPECT_TITLED, null); + file_count++; + + Map properties9 = new HashMap(); + MLText desc9 = new MLText(); + desc9.addValue(Locale.ENGLISH, "Nine"); + desc9.addValue(Locale.US, "Nine"); + properties9.put(ContentModel.PROP_CONTENT, new ContentData(null, "text/plain", 0L, "UTF-8", Locale.UK)); + properties9.put(ContentModel.PROP_DESCRIPTION, desc9); + properties9.put(ContentModel.PROP_TITLE, desc9); + properties9.put(ContentModel.PROP_CREATED, new Date()); + NodeRef c9 = nodeService.createNode(f9, ContentModel.ASSOC_CHILDREN, QName.createQName("cm", "Nine", namespaceService), ContentModel.TYPE_CONTENT, properties9) + .getChildRef(); + ContentWriter writer9 = contentService.getWriter(c9, ContentModel.PROP_CONTENT, true); + writer9.setEncoding("UTF-8"); + writer9.putContent("Nine zebra kiwi"); + nodeService.addAspect(c9, ContentModel.ASPECT_TITLED, null); + file_count++; + } + private T testQuery(String query, int size, boolean dump, String returnPropertyName, T returnType, boolean shouldThrow) + { + return testQuery(query, size, dump, returnPropertyName, returnType, shouldThrow, CMISQueryMode.CMS_STRICT); + } + + @SuppressWarnings("unchecked") + private T testQuery(String query, int size, boolean dump, String returnPropertyName, T returnType, boolean shouldThrow, CMISQueryMode mode) { CMISResultSet rs = null; try { T returnValue = null; - rs = cmisQueryService.query(query); + CMISQueryOptions options = new CMISQueryOptions(query, rootNodeRef.getStoreRef()); + options.setQueryMode(mode); + rs = cmisQueryService.query(options); for (CMISResultSetRow row : rs) { @@ -57,7 +302,7 @@ public class QueryTest extends BaseCMISTest { Serializable sValue = row.getValue(returnPropertyName); returnValue = (T) DefaultTypeConverter.INSTANCE.convert(returnType.getClass(), sValue); - if(dump) + if (dump) { System.out.println(cmisPropertyService.getProperties(row.getNodeRef(rs.getMetaData().getSelectorNames()[0]))); } @@ -117,593 +362,585 @@ public class QueryTest extends BaseCMISTest } } - + public void test_ALLOWED_CHILD_OBJECT_TYPES() { - testQuery("SELECT AllowedChildObjectTypeIds FROM Folder WHERE AllowedChildObjectTypeIds = 'test'", 0, false, "AllowedChildObjectTypeIds", new String(), false); - testQuery("SELECT AllowedChildObjectTypeIds FROM Folder WHERE AllowedChildObjectTypeIds <> 'test'", 33, false, "AllowedChildObjectTypeIds", new String(), false); - testQuery("SELECT AllowedChildObjectTypeIds FROM Folder WHERE AllowedChildObjectTypeIds < 'test'", 0, false, "AllowedChildObjectTypeIds", new String(), false); - testQuery("SELECT AllowedChildObjectTypeIds FROM Folder WHERE AllowedChildObjectTypeIds <= 'test'", 0, false, "AllowedChildObjectTypeIds", new String(), false); - testQuery("SELECT AllowedChildObjectTypeIds FROM Folder WHERE AllowedChildObjectTypeIds > 'test'", 0, false, "AllowedChildObjectTypeIds", new String(), false); - testQuery("SELECT AllowedChildObjectTypeIds FROM Folder WHERE AllowedChildObjectTypeIds >= 'test'", 0, false, "AllowedChildObjectTypeIds", new String(), false); + testQuery("SELECT AllowedChildObjectTypeIds FROM Folder WHERE AllowedChildObjectTypeIds = 'test'", 0, false, "AllowedChildObjectTypeIds", new String(), true); + testQuery("SELECT AllowedChildObjectTypeIds FROM Folder WHERE AllowedChildObjectTypeIds <> 'test'", 10, false, "AllowedChildObjectTypeIds", new String(), true); + testQuery("SELECT AllowedChildObjectTypeIds FROM Folder WHERE AllowedChildObjectTypeIds < 'test'", 0, false, "AllowedChildObjectTypeIds", new String(), true); + testQuery("SELECT AllowedChildObjectTypeIds FROM Folder WHERE AllowedChildObjectTypeIds <= 'test'", 0, false, "AllowedChildObjectTypeIds", new String(), true); + testQuery("SELECT AllowedChildObjectTypeIds FROM Folder WHERE AllowedChildObjectTypeIds > 'test'", 0, false, "AllowedChildObjectTypeIds", new String(), true); + testQuery("SELECT AllowedChildObjectTypeIds FROM Folder WHERE AllowedChildObjectTypeIds >= 'test'", 0, false, "AllowedChildObjectTypeIds", new String(), true); - testQuery("SELECT AllowedChildObjectTypeIds FROM Folder WHERE AllowedChildObjectTypeIds IN ('test')", 0, false, "AllowedChildObjectTypeIds", new String(), false); - testQuery("SELECT AllowedChildObjectTypeIds FROM Folder WHERE AllowedChildObjectTypeIds NOT IN ('test')", 33, false, "AllowedChildObjectTypeIds", new String(), false); + testQuery("SELECT AllowedChildObjectTypeIds FROM Folder WHERE AllowedChildObjectTypeIds IN ('test')", 0, false, "AllowedChildObjectTypeIds", new String(), true); + testQuery("SELECT AllowedChildObjectTypeIds FROM Folder WHERE AllowedChildObjectTypeIds NOT IN ('test')", 10, false, "AllowedChildObjectTypeIds", new String(), true); - testQuery("SELECT AllowedChildObjectTypeIds FROM Folder WHERE AllowedChildObjectTypeIds LIKE 'test'", 0, false, "AllowedChildObjectTypeIds", new String(), false); - testQuery("SELECT AllowedChildObjectTypeIds FROM Folder WHERE AllowedChildObjectTypeIds NOT LIKE 'test'", 0, false, "AllowedChildObjectTypeIds", new String(), false); + testQuery("SELECT AllowedChildObjectTypeIds FROM Folder WHERE AllowedChildObjectTypeIds LIKE 'test'", 0, false, "AllowedChildObjectTypeIds", new String(), true); + testQuery("SELECT AllowedChildObjectTypeIds FROM Folder WHERE AllowedChildObjectTypeIds NOT LIKE 'test'", 0, false, "AllowedChildObjectTypeIds", new String(), true); - testQuery("SELECT AllowedChildObjectTypeIds FROM Folder WHERE AllowedChildObjectTypeIds IS NOT NULL", 0, false, "AllowedChildObjectTypeIds", new String(), false); - testQuery("SELECT AllowedChildObjectTypeIds FROM Folder WHERE AllowedChildObjectTypeIds IS NULL", 33, false, "AllowedChildObjectTypeIds", new String(), false); + testQuery("SELECT AllowedChildObjectTypeIds FROM Folder WHERE AllowedChildObjectTypeIds IS NOT NULL", 0, false, "AllowedChildObjectTypeIds", new String(), true); + testQuery("SELECT AllowedChildObjectTypeIds FROM Folder WHERE AllowedChildObjectTypeIds IS NULL", 10, false, "AllowedChildObjectTypeIds", new String(), true); - testQuery("SELECT AllowedChildObjectTypeIds FROM Folder WHERE 'test' = ANY AllowedChildObjectTypeIds", 0, false, "AllowedChildObjectTypeIds", new String(), false); - testQuery("SELECT AllowedChildObjectTypeIds FROM Folder WHERE 'test' <> ANY AllowedChildObjectTypeIds", 33, false, "AllowedChildObjectTypeIds", new String(), false); - testQuery("SELECT AllowedChildObjectTypeIds FROM Folder WHERE 'test' < ANY AllowedChildObjectTypeIds", 0, false, "AllowedChildObjectTypeIds", new String(), false); - testQuery("SELECT AllowedChildObjectTypeIds FROM Folder WHERE 'test' <= ANY AllowedChildObjectTypeIds", 0, false, "AllowedChildObjectTypeIds", new String(), false); - testQuery("SELECT AllowedChildObjectTypeIds FROM Folder WHERE 'test' > ANY AllowedChildObjectTypeIds", 0, false, "AllowedChildObjectTypeIds", new String(), false); - testQuery("SELECT AllowedChildObjectTypeIds FROM Folder WHERE 'test' >= ANY AllowedChildObjectTypeIds", 0, false, "AllowedChildObjectTypeIds", new String(), false); + testQuery("SELECT AllowedChildObjectTypeIds FROM Folder WHERE 'test' = ANY AllowedChildObjectTypeIds", 0, false, "AllowedChildObjectTypeIds", new String(), true); + testQuery("SELECT AllowedChildObjectTypeIds FROM Folder WHERE 'test' <> ANY AllowedChildObjectTypeIds", 10, false, "AllowedChildObjectTypeIds", new String(), true); + testQuery("SELECT AllowedChildObjectTypeIds FROM Folder WHERE 'test' < ANY AllowedChildObjectTypeIds", 0, false, "AllowedChildObjectTypeIds", new String(), true); + testQuery("SELECT AllowedChildObjectTypeIds FROM Folder WHERE 'test' <= ANY AllowedChildObjectTypeIds", 0, false, "AllowedChildObjectTypeIds", new String(), true); + testQuery("SELECT AllowedChildObjectTypeIds FROM Folder WHERE 'test' > ANY AllowedChildObjectTypeIds", 0, false, "AllowedChildObjectTypeIds", new String(), true); + testQuery("SELECT AllowedChildObjectTypeIds FROM Folder WHERE 'test' >= ANY AllowedChildObjectTypeIds", 0, false, "AllowedChildObjectTypeIds", new String(), true); - testQuery("SELECT AllowedChildObjectTypeIds FROM Folder WHERE ANY AllowedChildObjectTypeIds IN ('test')", 0, false, "AllowedChildObjectTypeIds", new String(), false); - testQuery("SELECT AllowedChildObjectTypeIds FROM Folder WHERE ANY AllowedChildObjectTypeIds NOT IN ('test')", 33, false, "AllowedChildObjectTypeIds", new String(), false); + testQuery("SELECT AllowedChildObjectTypeIds FROM Folder WHERE ANY AllowedChildObjectTypeIds IN ('test')", 0, false, "AllowedChildObjectTypeIds", new String(), true); + testQuery("SELECT AllowedChildObjectTypeIds FROM Folder WHERE ANY AllowedChildObjectTypeIds NOT IN ('test')", 10, false, "AllowedChildObjectTypeIds", new String(), true); } - + public void test_PARENT() { - NodeRef rootNode = cmisService.getDefaultRootNodeRef(); - - testQuery("SELECT ParentId FROM Folder WHERE ParentId = '" + rootNode.toString() + "'", 4, false, "ParentId", new String(), false); - testQuery("SELECT ParentId FROM Folder WHERE ParentId <> '" + rootNode.toString() + "'", 29, false, "ParentId", new String(), false); - testQuery("SELECT ParentId FROM Folder WHERE ParentId < '" + rootNode.toString() + "'", 0, false, "ParentId", new String(), true); - testQuery("SELECT ParentId FROM Folder WHERE ParentId <= '" + rootNode.toString() + "'", 0, false, "ParentId", new String(), true); - testQuery("SELECT ParentId FROM Folder WHERE ParentId > '" + rootNode.toString() + "'", 0, false, "ParentId", new String(), true); - testQuery("SELECT ParentId FROM Folder WHERE ParentId >= '" + rootNode.toString() + "'", 0, false, "ParentId", new String(), true); + testQuery("SELECT ParentId FROM Folder WHERE ParentId = '" + rootNodeRef.toString() + "'", 4, false, "ParentId", new String(), false); + testQuery("SELECT ParentId FROM Folder WHERE ParentId <> '" + rootNodeRef.toString() + "'", 6, false, "ParentId", new String(), false); + testQuery("SELECT ParentId FROM Folder WHERE ParentId < '" + rootNodeRef.toString() + "'", 0, false, "ParentId", new String(), true); + testQuery("SELECT ParentId FROM Folder WHERE ParentId <= '" + rootNodeRef.toString() + "'", 0, false, "ParentId", new String(), true); + testQuery("SELECT ParentId FROM Folder WHERE ParentId > '" + rootNodeRef.toString() + "'", 0, false, "ParentId", new String(), true); + testQuery("SELECT ParentId FROM Folder WHERE ParentId >= '" + rootNodeRef.toString() + "'", 0, false, "ParentId", new String(), true); - testQuery("SELECT ParentId FROM Folder WHERE ParentId IN ('" + rootNode.toString() + "')", 4, false, "ParentId", new String(), false); - testQuery("SELECT ParentId FROM Folder WHERE ParentId NOT IN ('" + rootNode.toString() + "')", 29, false, "ParentId", new String(), false); + testQuery("SELECT ParentId FROM Folder WHERE ParentId IN ('" + rootNodeRef.toString() + "')", 4, false, "ParentId", new String(), false); + testQuery("SELECT ParentId FROM Folder WHERE ParentId NOT IN ('" + rootNodeRef.toString() + "')", 6, false, "ParentId", new String(), false); - testQuery("SELECT ParentId FROM Folder WHERE ParentId LIKE '" + rootNode.toString() + "'", 4, false, "ParentId", new String(), false); - testQuery("SELECT ParentId FROM Folder WHERE ParentId NOT LIKE '" + rootNode.toString() + "'", 29, false, "ParentId", new String(), false); + testQuery("SELECT ParentId FROM Folder WHERE ParentId LIKE '" + rootNodeRef.toString() + "'", 4, false, "ParentId", new String(), false); + testQuery("SELECT ParentId FROM Folder WHERE ParentId NOT LIKE '" + rootNodeRef.toString() + "'", 6, false, "ParentId", new String(), false); - testQuery("SELECT ParentId FROM Folder WHERE ParentId IS NOT NULL", 33, false, "ParentId", new String(), false); + testQuery("SELECT ParentId FROM Folder WHERE ParentId IS NOT NULL", 10, false, "ParentId", new String(), false); testQuery("SELECT ParentId FROM Folder WHERE ParentId IS NULL", 0, false, "ParentId", new String(), false); - testQuery("SELECT ParentId FROM Folder WHERE '" + rootNode.toString() + "' = ANY ParentId", 4, false, "ParentId", new String(), false); - testQuery("SELECT ParentId FROM Folder WHERE '" + rootNode.toString() + "' <> ANY ParentId", 29, false, "ParentId", new String(), false); - testQuery("SELECT ParentId FROM Folder WHERE '" + rootNode.toString() + "' < ANY ParentId", 0, false, "ParentId", new String(), true); - testQuery("SELECT ParentId FROM Folder WHERE '" + rootNode.toString() + "' <= ANY ParentId", 0, false, "ParentId", new String(), true); - testQuery("SELECT ParentId FROM Folder WHERE '" + rootNode.toString() + "' > ANY ParentId", 0, false, "ParentId", new String(), true); - testQuery("SELECT ParentId FROM Folder WHERE '" + rootNode.toString() + "' >= ANY ParentId", 0, false, "ParentId", new String(), true); + testQuery("SELECT ParentId FROM Folder WHERE '" + rootNodeRef.toString() + "' = ANY ParentId", 4, false, "ParentId", new String(), false); + testQuery("SELECT ParentId FROM Folder WHERE '" + rootNodeRef.toString() + "' <> ANY ParentId", 6, false, "ParentId", new String(), false); + testQuery("SELECT ParentId FROM Folder WHERE '" + rootNodeRef.toString() + "' < ANY ParentId", 0, false, "ParentId", new String(), true); + testQuery("SELECT ParentId FROM Folder WHERE '" + rootNodeRef.toString() + "' <= ANY ParentId", 0, false, "ParentId", new String(), true); + testQuery("SELECT ParentId FROM Folder WHERE '" + rootNodeRef.toString() + "' > ANY ParentId", 0, false, "ParentId", new String(), true); + testQuery("SELECT ParentId FROM Folder WHERE '" + rootNodeRef.toString() + "' >= ANY ParentId", 0, false, "ParentId", new String(), true); - testQuery("SELECT ParentId FROM Folder WHERE ANY ParentId IN ('" + rootNode.toString() + "')", 4, false, "ParentId", new String(), false); - testQuery("SELECT ParentId FROM Folder WHERE ANY ParentId NOT IN ('" + rootNode.toString() + "')", 29, false, "ParentId", new String(), false); + testQuery("SELECT ParentId FROM Folder WHERE ANY ParentId IN ('" + rootNodeRef.toString() + "')", 4, false, "ParentId", new String(), false); + testQuery("SELECT ParentId FROM Folder WHERE ANY ParentId NOT IN ('" + rootNodeRef.toString() + "')", 6, false, "ParentId", new String(), false); } - public void test_CONTENT_STREAM_URI() { - testQuery("SELECT ContentStreamUri FROM Document WHERE ContentStreamUri = 'test'", 0, false, "ContentStreamUri", new String(), false); - testQuery("SELECT ContentStreamUri FROM Document WHERE ContentStreamUri <> 'test'", 45, false, "ContentStreamUri", new String(), false); - testQuery("SELECT ContentStreamUri FROM Document WHERE ContentStreamUri < 'test'", 0, false, "ContentStreamUri", new String(), false); - testQuery("SELECT ContentStreamUri FROM Document WHERE ContentStreamUri <= 'test'", 0, false, "ContentStreamUri", new String(), false); - testQuery("SELECT ContentStreamUri FROM Document WHERE ContentStreamUri > 'test'", 0, false, "ContentStreamUri", new String(), false); - testQuery("SELECT ContentStreamUri FROM Document WHERE ContentStreamUri >= 'test'", 0, false, "ContentStreamUri", new String(), false); + testQuery("SELECT ContentStreamUri FROM Document WHERE ContentStreamUri = 'test'", 0, false, "ContentStreamUri", new String(), true); + testQuery("SELECT ContentStreamUri FROM Document WHERE ContentStreamUri <> 'test'", 10, false, "ContentStreamUri", new String(), true); + testQuery("SELECT ContentStreamUri FROM Document WHERE ContentStreamUri < 'test'", 0, false, "ContentStreamUri", new String(), true); + testQuery("SELECT ContentStreamUri FROM Document WHERE ContentStreamUri <= 'test'", 0, false, "ContentStreamUri", new String(), true); + testQuery("SELECT ContentStreamUri FROM Document WHERE ContentStreamUri > 'test'", 0, false, "ContentStreamUri", new String(), true); + testQuery("SELECT ContentStreamUri FROM Document WHERE ContentStreamUri >= 'test'", 0, false, "ContentStreamUri", new String(), true); - testQuery("SELECT ContentStreamUri FROM Document WHERE ContentStreamUri IN ('test')", 0, false, "ContentStreamUri", new String(), false); - testQuery("SELECT ContentStreamUri FROM Document WHERE ContentStreamUri NOT IN ('test')", 45, false, "ContentStreamUri", new String(), false); + testQuery("SELECT ContentStreamUri FROM Document WHERE ContentStreamUri IN ('test')", 0, false, "ContentStreamUri", new String(), true); + testQuery("SELECT ContentStreamUri FROM Document WHERE ContentStreamUri NOT IN ('test')", 10, false, "ContentStreamUri", new String(), true); - testQuery("SELECT ContentStreamUri FROM Document WHERE ContentStreamUri LIKE 'test'", 0, false, "ContentStreamUri", new String(), false); - testQuery("SELECT ContentStreamUri FROM Document WHERE ContentStreamUri NOT LIKE 'test'", 0, false, "ContentStreamUri", new String(), false); + testQuery("SELECT ContentStreamUri FROM Document WHERE ContentStreamUri LIKE 'test'", 0, false, "ContentStreamUri", new String(), true); + testQuery("SELECT ContentStreamUri FROM Document WHERE ContentStreamUri NOT LIKE 'test'", 0, false, "ContentStreamUri", new String(), true); - testQuery("SELECT ContentStreamUri FROM Document WHERE ContentStreamUri IS NOT NULL", 0, false, "ContentStreamUri", new String(), false); - testQuery("SELECT ContentStreamUri FROM Document WHERE ContentStreamUri IS NULL", 45, false, "ContentStreamUri", new String(), false); + testQuery("SELECT ContentStreamUri FROM Document WHERE ContentStreamUri IS NOT NULL", 0, false, "ContentStreamUri", new String(), true); + testQuery("SELECT ContentStreamUri FROM Document WHERE ContentStreamUri IS NULL", 10, false, "ContentStreamUri", new String(), true); - testQuery("SELECT ContentStreamUri FROM Document WHERE 'test' = ANY ContentStreamUri", 0, false, "ContentStreamUri", new String(), false); - testQuery("SELECT ContentStreamUri FROM Document WHERE 'test' <> ANY ContentStreamUri", 45, false, "ContentStreamUri", new String(), false); - testQuery("SELECT ContentStreamUri FROM Document WHERE 'test' < ANY ContentStreamUri", 0, false, "ContentStreamUri", new String(), false); - testQuery("SELECT ContentStreamUri FROM Document WHERE 'test' <= ANY ContentStreamUri", 0, false, "ContentStreamUri", new String(), false); - testQuery("SELECT ContentStreamUri FROM Document WHERE 'test' > ANY ContentStreamUri", 0, false, "ContentStreamUri", new String(), false); - testQuery("SELECT ContentStreamUri FROM Document WHERE 'test' >= ANY ContentStreamUri", 0, false, "ContentStreamUri", new String(), false); + testQuery("SELECT ContentStreamUri FROM Document WHERE 'test' = ANY ContentStreamUri", 0, false, "ContentStreamUri", new String(), true); + testQuery("SELECT ContentStreamUri FROM Document WHERE 'test' <> ANY ContentStreamUri", 10, false, "ContentStreamUri", new String(), true); + testQuery("SELECT ContentStreamUri FROM Document WHERE 'test' < ANY ContentStreamUri", 0, false, "ContentStreamUri", new String(), true); + testQuery("SELECT ContentStreamUri FROM Document WHERE 'test' <= ANY ContentStreamUri", 0, false, "ContentStreamUri", new String(), true); + testQuery("SELECT ContentStreamUri FROM Document WHERE 'test' > ANY ContentStreamUri", 0, false, "ContentStreamUri", new String(), true); + testQuery("SELECT ContentStreamUri FROM Document WHERE 'test' >= ANY ContentStreamUri", 0, false, "ContentStreamUri", new String(), true); - testQuery("SELECT ContentStreamUri FROM Document WHERE ANY ContentStreamUri IN ('test')", 0, false, "ContentStreamUri", new String(), false); - testQuery("SELECT ContentStreamUri FROM Document WHERE ANY ContentStreamUri NOT IN ('test')", 45, false, "ContentStreamUri", new String(), false); + testQuery("SELECT ContentStreamUri FROM Document WHERE ANY ContentStreamUri IN ('test')", 0, false, "ContentStreamUri", new String(), true); + testQuery("SELECT ContentStreamUri FROM Document WHERE ANY ContentStreamUri NOT IN ('test')", 10, false, "ContentStreamUri", new String(), true); } - public void test_CONTENT_STREAM_FILENAME() { - testQuery("SELECT ContentStreamFilename FROM Document WHERE ContentStreamFilename = 'tutorial'", 0, false, "ContentStreamFilename", new String(), false); - testQuery("SELECT ContentStreamFilename FROM Document WHERE ContentStreamFilename <> 'tutorial'", 45, false, "ContentStreamFilename", new String(), false); - testQuery("SELECT ContentStreamFilename FROM Document WHERE ContentStreamFilename < 'tutorial'", 45, false, "ContentStreamFilename", new String(), false); - testQuery("SELECT ContentStreamFilename FROM Document WHERE ContentStreamFilename <= 'tutorial'", 45, false, "ContentStreamFilename", new String(), false); - testQuery("SELECT ContentStreamFilename FROM Document WHERE ContentStreamFilename > 'tutorial'", 8, true, "ContentStreamFilename", new String(), false); - testQuery("SELECT ContentStreamFilename FROM Document WHERE ContentStreamFilename >= 'tutorial'", 8, false, "ContentStreamFilename", new String(), false); + testQuery("SELECT ContentStreamFilename FROM Document WHERE ContentStreamFilename = 'tutorial'", 1, false, "ContentStreamFilename", new String(), false); + testQuery("SELECT ContentStreamFilename FROM Document WHERE ContentStreamFilename <> 'tutorial'", 9, false, "ContentStreamFilename", new String(), false); + testQuery("SELECT ContentStreamFilename FROM Document WHERE ContentStreamFilename < 'tutorial'", 10, false, "ContentStreamFilename", new String(), false); + testQuery("SELECT ContentStreamFilename FROM Document WHERE ContentStreamFilename <= 'tutorial'", 10, false, "ContentStreamFilename", new String(), false); + testQuery("SELECT ContentStreamFilename FROM Document WHERE ContentStreamFilename > 'tutorial'", 0, true, "ContentStreamFilename", new String(), false); + testQuery("SELECT ContentStreamFilename FROM Document WHERE ContentStreamFilename >= 'tutorial'", 1, false, "ContentStreamFilename", new String(), false); - testQuery("SELECT ContentStreamFilename FROM Document WHERE ContentStreamFilename IN ('tutorial')", 0, false, "ContentStreamFilename", new String(), false); - testQuery("SELECT ContentStreamFilename FROM Document WHERE ContentStreamFilename NOT IN ('tutorial')", 45, false, "ContentStreamFilename", new String(), false); + testQuery("SELECT ContentStreamFilename FROM Document WHERE ContentStreamFilename IN ('tutorial')", 1, false, "ContentStreamFilename", new String(), false); + testQuery("SELECT ContentStreamFilename FROM Document WHERE ContentStreamFilename NOT IN ('tutorial')", 9, false, "ContentStreamFilename", new String(), false); - testQuery("SELECT ContentStreamFilename FROM Document WHERE ContentStreamFilename LIKE 'tutorial'", 0, false, "ContentStreamFilename", new String(), false); - testQuery("SELECT ContentStreamFilename FROM Document WHERE ContentStreamFilename NOT LIKE 'tutorial'", 45, false, "ContentStreamFilename", new String(), false); + testQuery("SELECT ContentStreamFilename FROM Document WHERE ContentStreamFilename LIKE 'tutorial'", 1, false, "ContentStreamFilename", new String(), false); + testQuery("SELECT ContentStreamFilename FROM Document WHERE ContentStreamFilename NOT LIKE 'tutorial'", 9, false, "ContentStreamFilename", new String(), false); - testQuery("SELECT ContentStreamFilename FROM Document WHERE ContentStreamFilename IS NOT NULL", 45, false, "ContentStreamFilename", new String(), false); + testQuery("SELECT ContentStreamFilename FROM Document WHERE ContentStreamFilename IS NOT NULL", 10, false, "ContentStreamFilename", new String(), false); testQuery("SELECT ContentStreamFilename FROM Document WHERE ContentStreamFilename IS NULL", 0, false, "ContentStreamFilename", new String(), false); - testQuery("SELECT ContentStreamFilename FROM Document WHERE 'tutorial' = ANY ContentStreamFilename", 0, false, "ContentStreamFilename", new String(), false); - testQuery("SELECT ContentStreamFilename FROM Document WHERE 'tutorial' <> ANY ContentStreamFilename", 45, false, "ContentStreamFilename", new String(), false); - testQuery("SELECT ContentStreamFilename FROM Document WHERE 'tutorial' < ANY ContentStreamFilename", 45, false, "ContentStreamFilename", new String(), false); - testQuery("SELECT ContentStreamFilename FROM Document WHERE 'tutorial' <= ANY ContentStreamFilename", 45, false, "ContentStreamFilename", new String(), false); - testQuery("SELECT ContentStreamFilename FROM Document WHERE 'tutorial' > ANY ContentStreamFilename", 8, false, "ContentStreamFilename", new String(), false); - testQuery("SELECT ContentStreamFilename FROM Document WHERE 'tutorial' >= ANY ContentStreamFilename", 8, false, "ContentStreamFilename", new String(), false); + testQuery("SELECT ContentStreamFilename FROM Document WHERE 'tutorial' = ANY ContentStreamFilename", 1, false, "ContentStreamFilename", new String(), false); + testQuery("SELECT ContentStreamFilename FROM Document WHERE 'tutorial' <> ANY ContentStreamFilename", 9, false, "ContentStreamFilename", new String(), false); + testQuery("SELECT ContentStreamFilename FROM Document WHERE 'tutorial' < ANY ContentStreamFilename", 10, false, "ContentStreamFilename", new String(), false); + testQuery("SELECT ContentStreamFilename FROM Document WHERE 'tutorial' <= ANY ContentStreamFilename", 10, false, "ContentStreamFilename", new String(), false); + testQuery("SELECT ContentStreamFilename FROM Document WHERE 'tutorial' > ANY ContentStreamFilename", 0, false, "ContentStreamFilename", new String(), false); + testQuery("SELECT ContentStreamFilename FROM Document WHERE 'tutorial' >= ANY ContentStreamFilename", 1, false, "ContentStreamFilename", new String(), false); - testQuery("SELECT ContentStreamFilename FROM Document WHERE ANY ContentStreamFilename IN ('tutorial')", 0, false, "ContentStreamFilename", new String(), false); - testQuery("SELECT ContentStreamFilename FROM Document WHERE ANY ContentStreamFilename NOT IN ('tutorial')", 45, false, "ContentStreamFilename", new String(), false); + testQuery("SELECT ContentStreamFilename FROM Document WHERE ANY ContentStreamFilename IN ('tutorial')", 1, false, "ContentStreamFilename", new String(), false); + testQuery("SELECT ContentStreamFilename FROM Document WHERE ANY ContentStreamFilename NOT IN ('tutorial')", 9, false, "ContentStreamFilename", new String(), false); } - + public void test_CONTENT_STREAM_MIME_TYPE() { - testQuery("SELECT ContentStreamMimeType FROM Document WHERE ContentStreamMimeType = 'text/plain'", 27, false, "ContentStreamMimeType", new String(), false); - testQuery("SELECT ContentStreamMimeType FROM Document WHERE ContentStreamMimeType <> 'text/plain'", 18, false, "ContentStreamMimeType", new String(), false); - testQuery("SELECT ContentStreamMimeType FROM Document WHERE ContentStreamMimeType < 'text/plain'", 13, true, "ContentStreamMimeType", new String(), false); - testQuery("SELECT ContentStreamMimeType FROM Document WHERE ContentStreamMimeType <= 'text/plain'", 40, false, "ContentStreamMimeType", new String(), false); - testQuery("SELECT ContentStreamMimeType FROM Document WHERE ContentStreamMimeType > 'text/plain'", 5, false, "ContentStreamMimeType", new String(), false); - testQuery("SELECT ContentStreamMimeType FROM Document WHERE ContentStreamMimeType >= 'text/plain'", 32, false, "ContentStreamMimeType", new String(), false); + testQuery("SELECT ContentStreamMimeType FROM Document WHERE ContentStreamMimeType = 'text/plain'", 10, false, "ContentStreamMimeType", new String(), false); + testQuery("SELECT ContentStreamMimeType FROM Document WHERE ContentStreamMimeType <> 'text/plain'", 0, false, "ContentStreamMimeType", new String(), false); + testQuery("SELECT ContentStreamMimeType FROM Document WHERE ContentStreamMimeType < 'text/plain'", 0, true, "ContentStreamMimeType", new String(), false); + testQuery("SELECT ContentStreamMimeType FROM Document WHERE ContentStreamMimeType <= 'text/plain'", 10, false, "ContentStreamMimeType", new String(), false); + testQuery("SELECT ContentStreamMimeType FROM Document WHERE ContentStreamMimeType > 'text/plain'", 0, false, "ContentStreamMimeType", new String(), false); + testQuery("SELECT ContentStreamMimeType FROM Document WHERE ContentStreamMimeType >= 'text/plain'", 10, false, "ContentStreamMimeType", new String(), false); - testQuery("SELECT ContentStreamMimeType FROM Document WHERE ContentStreamMimeType IN ('text/plain')", 27, false, "ContentStreamMimeType", new String(), false); - testQuery("SELECT ContentStreamMimeType FROM Document WHERE ContentStreamMimeType NOT IN ('text/plain')", 18, false, "ContentStreamMimeType", new String(), false); + testQuery("SELECT ContentStreamMimeType FROM Document WHERE ContentStreamMimeType IN ('text/plain')", 10, false, "ContentStreamMimeType", new String(), false); + testQuery("SELECT ContentStreamMimeType FROM Document WHERE ContentStreamMimeType NOT IN ('text/plain')", 0, false, "ContentStreamMimeType", new String(), false); - testQuery("SELECT ContentStreamMimeType FROM Document WHERE ContentStreamMimeType LIKE 'text/plain'", 27, false, "ContentStreamMimeType", new String(), false); - testQuery("SELECT ContentStreamMimeType FROM Document WHERE ContentStreamMimeType NOT LIKE 'text/plain'", 18, false, "ContentStreamMimeType", new String(), false); + testQuery("SELECT ContentStreamMimeType FROM Document WHERE ContentStreamMimeType LIKE 'text/plain'", 10, false, "ContentStreamMimeType", new String(), false); + testQuery("SELECT ContentStreamMimeType FROM Document WHERE ContentStreamMimeType NOT LIKE 'text/plain'", 0, false, "ContentStreamMimeType", new String(), false); - testQuery("SELECT ContentStreamMimeType FROM Document WHERE ContentStreamMimeType IS NOT NULL", 45, false, "ContentStreamMimeType", new String(), false); + testQuery("SELECT ContentStreamMimeType FROM Document WHERE ContentStreamMimeType IS NOT NULL", 10, false, "ContentStreamMimeType", new String(), false); testQuery("SELECT ContentStreamMimeType FROM Document WHERE ContentStreamMimeType IS NULL", 0, false, "ContentStreamMimeType", new String(), false); - testQuery("SELECT ContentStreamMimeType FROM Document WHERE 'text/plain' = ANY ContentStreamMimeType", 27, false, "ContentStreamMimeType", new String(), false); - testQuery("SELECT ContentStreamMimeType FROM Document WHERE 'text/plain' <> ANY ContentStreamMimeType", 18, false, "ContentStreamMimeType", new String(), false); - testQuery("SELECT ContentStreamMimeType FROM Document WHERE 'text/plain' < ANY ContentStreamMimeType", 13, false, "ContentStreamMimeType", new String(), false); - testQuery("SELECT ContentStreamMimeType FROM Document WHERE 'text/plain' <= ANY ContentStreamMimeType", 40, false, "ContentStreamMimeType", new String(), false); - testQuery("SELECT ContentStreamMimeType FROM Document WHERE 'text/plain' > ANY ContentStreamMimeType", 5, false, "ContentStreamMimeType", new String(), false); - testQuery("SELECT ContentStreamMimeType FROM Document WHERE 'text/plain' >= ANY ContentStreamMimeType", 32, false, "ContentStreamMimeType", new String(), false); + testQuery("SELECT ContentStreamMimeType FROM Document WHERE 'text/plain' = ANY ContentStreamMimeType", 10, false, "ContentStreamMimeType", new String(), false); + testQuery("SELECT ContentStreamMimeType FROM Document WHERE 'text/plain' <> ANY ContentStreamMimeType", 0, false, "ContentStreamMimeType", new String(), false); + testQuery("SELECT ContentStreamMimeType FROM Document WHERE 'text/plain' < ANY ContentStreamMimeType", 0, false, "ContentStreamMimeType", new String(), false); + testQuery("SELECT ContentStreamMimeType FROM Document WHERE 'text/plain' <= ANY ContentStreamMimeType", 10, false, "ContentStreamMimeType", new String(), false); + testQuery("SELECT ContentStreamMimeType FROM Document WHERE 'text/plain' > ANY ContentStreamMimeType", 0, false, "ContentStreamMimeType", new String(), false); + testQuery("SELECT ContentStreamMimeType FROM Document WHERE 'text/plain' >= ANY ContentStreamMimeType", 10, false, "ContentStreamMimeType", new String(), false); - testQuery("SELECT ContentStreamMimeType FROM Document WHERE ANY ContentStreamMimeType IN ('text/plain')", 27, false, "ContentStreamMimeType", new String(), false); - testQuery("SELECT ContentStreamMimeType FROM Document WHERE ANY ContentStreamMimeType NOT IN ('text/plain')", 18, false, "ContentStreamMimeType", new String(), false); + testQuery("SELECT ContentStreamMimeType FROM Document WHERE ANY ContentStreamMimeType IN ('text/plain')", 10, false, "ContentStreamMimeType", new String(), false); + testQuery("SELECT ContentStreamMimeType FROM Document WHERE ANY ContentStreamMimeType NOT IN ('text/plain')", 0, false, "ContentStreamMimeType", new String(), false); } public void test_CONTENT_STREAM_LENGTH() { - testQuery("SELECT ContentStreamLength FROM Document WHERE ContentStreamLength = 750", 1, false, "ContentStreamLength", new String(), false); - testQuery("SELECT ContentStreamLength FROM Document WHERE ContentStreamLength <> 750", 44, true, "ContentStreamLength", new String(), false); - testQuery("SELECT ContentStreamLength FROM Document WHERE ContentStreamLength < 750", 28, false, "ContentStreamLength", new String(), false); - testQuery("SELECT ContentStreamLength FROM Document WHERE ContentStreamLength <= 750", 29, false, "ContentStreamLength", new String(), false); - testQuery("SELECT ContentStreamLength FROM Document WHERE ContentStreamLength > 750", 16, false, "ContentStreamLength", new String(), false); - testQuery("SELECT ContentStreamLength FROM Document WHERE ContentStreamLength >= 750", 17, false, "ContentStreamLength", new String(), false); + testQuery("SELECT ContentStreamLength FROM Document WHERE ContentStreamLength = 750", 0, false, "ContentStreamLength", new String(), false); + testQuery("SELECT ContentStreamLength FROM Document WHERE ContentStreamLength <> 750", 10, true, "ContentStreamLength", new String(), false); + testQuery("SELECT ContentStreamLength FROM Document WHERE ContentStreamLength < 750", 10, false, "ContentStreamLength", new String(), false); + testQuery("SELECT ContentStreamLength FROM Document WHERE ContentStreamLength <= 750", 10, false, "ContentStreamLength", new String(), false); + testQuery("SELECT ContentStreamLength FROM Document WHERE ContentStreamLength > 750", 0, false, "ContentStreamLength", new String(), false); + testQuery("SELECT ContentStreamLength FROM Document WHERE ContentStreamLength >= 750", 0, false, "ContentStreamLength", new String(), false); - testQuery("SELECT ContentStreamLength FROM Document WHERE ContentStreamLength IN (750)", 1, false, "ContentStreamLength", new String(), false); - testQuery("SELECT ContentStreamLength FROM Document WHERE ContentStreamLength NOT IN (750)", 44, false, "ContentStreamLength", new String(), false); + testQuery("SELECT ContentStreamLength FROM Document WHERE ContentStreamLength IN (750)", 0, false, "ContentStreamLength", new String(), false); + testQuery("SELECT ContentStreamLength FROM Document WHERE ContentStreamLength NOT IN (750)", 10, false, "ContentStreamLength", new String(), false); - testQuery("SELECT ContentStreamLength FROM Document WHERE ContentStreamLength LIKE '750'", 1, false, "ContentStreamLength", new String(), false); - testQuery("SELECT ContentStreamLength FROM Document WHERE ContentStreamLength NOT LIKE '750'", 44, false, "ContentStreamLength", new String(), false); + testQuery("SELECT ContentStreamLength FROM Document WHERE ContentStreamLength LIKE '750'", 0, false, "ContentStreamLength", new String(), false); + testQuery("SELECT ContentStreamLength FROM Document WHERE ContentStreamLength NOT LIKE '750'", 10, false, "ContentStreamLength", new String(), false); - testQuery("SELECT ContentStreamLength FROM Document WHERE ContentStreamLength IS NOT NULL", 45, false, "ContentStreamLength", new String(), false); + testQuery("SELECT ContentStreamLength FROM Document WHERE ContentStreamLength IS NOT NULL", 10, false, "ContentStreamLength", new String(), false); testQuery("SELECT ContentStreamLength FROM Document WHERE ContentStreamLength IS NULL", 0, false, "ContentStreamLength", new String(), false); - testQuery("SELECT ContentStreamLength FROM Document WHERE 750 = ANY ContentStreamLength", 1, false, "ContentStreamLength", new String(), false); - testQuery("SELECT ContentStreamLength FROM Document WHERE 750 <> ANY ContentStreamLength", 44, false, "ContentStreamLength", new String(), false); - testQuery("SELECT ContentStreamLength FROM Document WHERE 750 < ANY ContentStreamLength", 28, false, "ContentStreamLength", new String(), false); - testQuery("SELECT ContentStreamLength FROM Document WHERE 750 <= ANY ContentStreamLength", 29, false, "ContentStreamLength", new String(), false); - testQuery("SELECT ContentStreamLength FROM Document WHERE 750 > ANY ContentStreamLength", 16, false, "ContentStreamLength", new String(), false); - testQuery("SELECT ContentStreamLength FROM Document WHERE 750 >= ANY ContentStreamLength", 17, false, "ContentStreamLength", new String(), false); + testQuery("SELECT ContentStreamLength FROM Document WHERE 750 = ANY ContentStreamLength", 0, false, "ContentStreamLength", new String(), false); + testQuery("SELECT ContentStreamLength FROM Document WHERE 750 <> ANY ContentStreamLength", 10, false, "ContentStreamLength", new String(), false); + testQuery("SELECT ContentStreamLength FROM Document WHERE 750 < ANY ContentStreamLength", 10, false, "ContentStreamLength", new String(), false); + testQuery("SELECT ContentStreamLength FROM Document WHERE 750 <= ANY ContentStreamLength", 10, false, "ContentStreamLength", new String(), false); + testQuery("SELECT ContentStreamLength FROM Document WHERE 750 > ANY ContentStreamLength", 0, false, "ContentStreamLength", new String(), false); + testQuery("SELECT ContentStreamLength FROM Document WHERE 750 >= ANY ContentStreamLength", 0, false, "ContentStreamLength", new String(), false); - testQuery("SELECT ContentStreamLength FROM Document WHERE ANY ContentStreamLength IN (750)", 1, false, "ContentStreamLength", new String(), false); - testQuery("SELECT ContentStreamLength FROM Document WHERE ANY ContentStreamLength NOT IN (750)", 44, false, "ContentStreamLength", new String(), false); + testQuery("SELECT ContentStreamLength FROM Document WHERE ANY ContentStreamLength IN (750)", 0, false, "ContentStreamLength", new String(), false); + testQuery("SELECT ContentStreamLength FROM Document WHERE ANY ContentStreamLength NOT IN (750)", 10, false, "ContentStreamLength", new String(), false); } - - + public void test_CONTENT_STREAM_ALLOWED() { - testQuery("SELECT ContentStreamAllowed FROM Document WHERE ContentStreamAllowed = 'ALLOWED'", 45, false, "ObjectId", new String(), false); - testQuery("SELECT ContentStreamAllowed FROM Document WHERE ContentStreamAllowed <> 'ALLOWED'", 0, false, "ObjectId", new String(), false); - testQuery("SELECT ContentStreamAllowed FROM Document WHERE ContentStreamAllowed < 'ALLOWED'", 0, false, "ObjectId", new String(), false); - testQuery("SELECT ContentStreamAllowed FROM Document WHERE ContentStreamAllowed <= 'ALLOWED'", 45, false, "ObjectId", new String(), false); - testQuery("SELECT ContentStreamAllowed FROM Document WHERE ContentStreamAllowed > 'ALLOWED'", 0, false, "ObjectId", new String(), false); - testQuery("SELECT ContentStreamAllowed FROM Document WHERE ContentStreamAllowed >= 'ALLOWED'", 45, false, "ObjectId", new String(), false); + testQuery("SELECT ContentStreamAllowed FROM Document WHERE ContentStreamAllowed = 'ALLOWED'", 10, false, "ObjectId", new String(), true); + testQuery("SELECT ContentStreamAllowed FROM Document WHERE ContentStreamAllowed <> 'ALLOWED'", 0, false, "ObjectId", new String(), true); + testQuery("SELECT ContentStreamAllowed FROM Document WHERE ContentStreamAllowed < 'ALLOWED'", 0, false, "ObjectId", new String(), true); + testQuery("SELECT ContentStreamAllowed FROM Document WHERE ContentStreamAllowed <= 'ALLOWED'", 10, false, "ObjectId", new String(), true); + testQuery("SELECT ContentStreamAllowed FROM Document WHERE ContentStreamAllowed > 'ALLOWED'", 0, false, "ObjectId", new String(), true); + testQuery("SELECT ContentStreamAllowed FROM Document WHERE ContentStreamAllowed >= 'ALLOWED'", 10, false, "ObjectId", new String(), true); - testQuery("SELECT ContentStreamAllowed FROM Document WHERE ContentStreamAllowed IN ('ALLOWED')", 45, false, "ObjectId", new String(), false); - testQuery("SELECT ContentStreamAllowed FROM Document WHERE ContentStreamAllowed NOT IN ('ALLOWED')", 0, false, "ObjectId", new String(), false); + testQuery("SELECT ContentStreamAllowed FROM Document WHERE ContentStreamAllowed IN ('ALLOWED')", 10, false, "ObjectId", new String(), true); + testQuery("SELECT ContentStreamAllowed FROM Document WHERE ContentStreamAllowed NOT IN ('ALLOWED')", 0, false, "ObjectId", new String(), true); - testQuery("SELECT ContentStreamAllowed FROM Document WHERE ContentStreamAllowed LIKE 'ALLOWED'", 45, false, "ObjectId", new String(), false); - testQuery("SELECT ContentStreamAllowed FROM Document WHERE ContentStreamAllowed NOT LIKE 'ALLOWED'", 0, false, "ObjectId", new String(), false); + testQuery("SELECT ContentStreamAllowed FROM Document WHERE ContentStreamAllowed LIKE 'ALLOWED'", 10, false, "ObjectId", new String(), true); + testQuery("SELECT ContentStreamAllowed FROM Document WHERE ContentStreamAllowed NOT LIKE 'ALLOWED'", 0, false, "ObjectId", new String(), true); - testQuery("SELECT ContentStreamAllowed FROM Document WHERE ContentStreamAllowed IS NOT NULL", 45, false, "ObjectId", new String(), false); - testQuery("SELECT ContentStreamAllowed FROM Document WHERE ContentStreamAllowed IS NULL", 0, false, "ObjectId", new String(), false); + testQuery("SELECT ContentStreamAllowed FROM Document WHERE ContentStreamAllowed IS NOT NULL", 10, false, "ObjectId", new String(), true); + testQuery("SELECT ContentStreamAllowed FROM Document WHERE ContentStreamAllowed IS NULL", 0, false, "ObjectId", new String(), true); - testQuery("SELECT ContentStreamAllowed FROM Document WHERE 'ALLOWED' = ANY ContentStreamAllowed", 45, false, "ObjectId", new String(), false); - testQuery("SELECT ContentStreamAllowed FROM Document WHERE 'ALLOWED' <> ANY ContentStreamAllowed", 0, false, "ObjectId", new String(), false); - testQuery("SELECT ContentStreamAllowed FROM Document WHERE 'ALLOWED' < ANY ContentStreamAllowed", 0, false, "ObjectId", new String(), false); - testQuery("SELECT ContentStreamAllowed FROM Document WHERE 'ALLOWED' <= ANY ContentStreamAllowed", 45, false, "ObjectId", new String(), false); - testQuery("SELECT ContentStreamAllowed FROM Document WHERE 'ALLOWED' > ANY ContentStreamAllowed", 0, false, "ObjectId", new String(), false); - testQuery("SELECT ContentStreamAllowed FROM Document WHERE 'ALLOWED' >= ANY ContentStreamAllowed", 45, false, "ObjectId", new String(), false); + testQuery("SELECT ContentStreamAllowed FROM Document WHERE 'ALLOWED' = ANY ContentStreamAllowed", 10, false, "ObjectId", new String(), true); + testQuery("SELECT ContentStreamAllowed FROM Document WHERE 'ALLOWED' <> ANY ContentStreamAllowed", 0, false, "ObjectId", new String(), true); + testQuery("SELECT ContentStreamAllowed FROM Document WHERE 'ALLOWED' < ANY ContentStreamAllowed", 0, false, "ObjectId", new String(), true); + testQuery("SELECT ContentStreamAllowed FROM Document WHERE 'ALLOWED' <= ANY ContentStreamAllowed", 10, false, "ObjectId", new String(), true); + testQuery("SELECT ContentStreamAllowed FROM Document WHERE 'ALLOWED' > ANY ContentStreamAllowed", 0, false, "ObjectId", new String(), true); + testQuery("SELECT ContentStreamAllowed FROM Document WHERE 'ALLOWED' >= ANY ContentStreamAllowed", 10, false, "ObjectId", new String(), true); - testQuery("SELECT ContentStreamAllowed FROM Document WHERE ANY ContentStreamAllowed IN ('ALLOWED')", 45, false, "ObjectId", new String(), false); - testQuery("SELECT ContentStreamAllowed FROM Document WHERE ANY ContentStreamAllowed NOT IN ('ALLOWED')", 0, false, "ObjectId", new String(), false); + testQuery("SELECT ContentStreamAllowed FROM Document WHERE ANY ContentStreamAllowed IN ('ALLOWED')", 10, false, "ObjectId", new String(), true); + testQuery("SELECT ContentStreamAllowed FROM Document WHERE ANY ContentStreamAllowed NOT IN ('ALLOWED')", 0, false, "ObjectId", new String(), true); } - public void test_CHECKIN_COMMENT() { testQuery("SELECT CheckinComment FROM Document WHERE CheckinComment = 'admin'", 0, false, "ObjectId", new String(), true); - testQuery("SELECT CheckinComment FROM Document WHERE CheckinComment <> 'admin'", 45, false, "ObjectId", new String(), true); + testQuery("SELECT CheckinComment FROM Document WHERE CheckinComment <> 'admin'", 10, false, "ObjectId", new String(), true); testQuery("SELECT CheckinComment FROM Document WHERE CheckinComment < 'admin'", 0, false, "ObjectId", new String(), true); testQuery("SELECT CheckinComment FROM Document WHERE CheckinComment <= 'admin'", 0, false, "ObjectId", new String(), true); testQuery("SELECT CheckinComment FROM Document WHERE CheckinComment > 'admin'", 0, false, "ObjectId", new String(), true); testQuery("SELECT CheckinComment FROM Document WHERE CheckinComment >= 'admin'", 0, false, "ObjectId", new String(), true); testQuery("SELECT CheckinComment FROM Document WHERE CheckinComment IN ('admin')", 0, false, "ObjectId", new String(), true); - testQuery("SELECT CheckinComment FROM Document WHERE CheckinComment NOT IN ('admin')", 45, false, "ObjectId", new String(), true); + testQuery("SELECT CheckinComment FROM Document WHERE CheckinComment NOT IN ('admin')", 10, false, "ObjectId", new String(), true); testQuery("SELECT CheckinComment FROM Document WHERE CheckinComment LIKE 'admin'", 0, false, "ObjectId", new String(), true); - testQuery("SELECT CheckinComment FROM Document WHERE CheckinComment NOT LIKE 'admin'", 45, false, "ObjectId", new String(), true); + testQuery("SELECT CheckinComment FROM Document WHERE CheckinComment NOT LIKE 'admin'", 10, false, "ObjectId", new String(), true); testQuery("SELECT CheckinComment FROM Document WHERE CheckinComment IS NOT NULL", 0, false, "ObjectId", new String(), true); - testQuery("SELECT CheckinComment FROM Document WHERE CheckinComment IS NULL", 45, false, "ObjectId", new String(), true); + testQuery("SELECT CheckinComment FROM Document WHERE CheckinComment IS NULL", 10, false, "ObjectId", new String(), true); testQuery("SELECT CheckinComment FROM Document WHERE 'admin' = ANY CheckinComment", 0, false, "ObjectId", new String(), true); - testQuery("SELECT CheckinComment FROM Document WHERE 'admin' <> ANY CheckinComment", 45, false, "ObjectId", new String(), true); + testQuery("SELECT CheckinComment FROM Document WHERE 'admin' <> ANY CheckinComment", 10, false, "ObjectId", new String(), true); testQuery("SELECT CheckinComment FROM Document WHERE 'admin' < ANY CheckinComment", 0, false, "ObjectId", new String(), true); testQuery("SELECT CheckinComment FROM Document WHERE 'admin' <= ANY CheckinComment", 0, false, "ObjectId", new String(), true); testQuery("SELECT CheckinComment FROM Document WHERE 'admin' > ANY CheckinComment", 0, false, "ObjectId", new String(), true); testQuery("SELECT CheckinComment FROM Document WHERE 'admin' >= ANY CheckinComment", 0, false, "ObjectId", new String(), true); testQuery("SELECT CheckinComment FROM Document WHERE ANY CheckinComment IN ('admin')", 0, false, "ObjectId", new String(), true); - testQuery("SELECT CheckinComment FROM Document WHERE ANY CheckinComment NOT IN ('admin')", 45, false, "ObjectId", new String(), true); + testQuery("SELECT CheckinComment FROM Document WHERE ANY CheckinComment NOT IN ('admin')", 10, false, "ObjectId", new String(), true); } - + public void test_VERSION_SERIES_CHECKED_OUT_ID() { testQuery("SELECT VersionSeriesCheckedOutId FROM Document WHERE VersionSeriesCheckedOutId = 'admin'", 0, false, "ObjectId", new String(), true); - testQuery("SELECT VersionSeriesCheckedOutId FROM Document WHERE VersionSeriesCheckedOutId <> 'admin'", 45, false, "ObjectId", new String(), true); + testQuery("SELECT VersionSeriesCheckedOutId FROM Document WHERE VersionSeriesCheckedOutId <> 'admin'", 10, false, "ObjectId", new String(), true); testQuery("SELECT VersionSeriesCheckedOutId FROM Document WHERE VersionSeriesCheckedOutId < 'admin'", 0, false, "ObjectId", new String(), true); testQuery("SELECT VersionSeriesCheckedOutId FROM Document WHERE VersionSeriesCheckedOutId <= 'admin'", 0, false, "ObjectId", new String(), true); testQuery("SELECT VersionSeriesCheckedOutId FROM Document WHERE VersionSeriesCheckedOutId > 'admin'", 0, false, "ObjectId", new String(), true); testQuery("SELECT VersionSeriesCheckedOutId FROM Document WHERE VersionSeriesCheckedOutId >= 'admin'", 0, false, "ObjectId", new String(), true); testQuery("SELECT VersionSeriesCheckedOutId FROM Document WHERE VersionSeriesCheckedOutId IN ('admin')", 0, false, "ObjectId", new String(), true); - testQuery("SELECT VersionSeriesCheckedOutId FROM Document WHERE VersionSeriesCheckedOutId NOT IN ('admin')", 45, false, "ObjectId", new String(), true); + testQuery("SELECT VersionSeriesCheckedOutId FROM Document WHERE VersionSeriesCheckedOutId NOT IN ('admin')", 10, false, "ObjectId", new String(), true); testQuery("SELECT VersionSeriesCheckedOutId FROM Document WHERE VersionSeriesCheckedOutId LIKE 'admin'", 0, false, "ObjectId", new String(), true); - testQuery("SELECT VersionSeriesCheckedOutId FROM Document WHERE VersionSeriesCheckedOutId NOT LIKE 'admin'", 45, false, "ObjectId", new String(), true); + testQuery("SELECT VersionSeriesCheckedOutId FROM Document WHERE VersionSeriesCheckedOutId NOT LIKE 'admin'", 10, false, "ObjectId", new String(), true); testQuery("SELECT VersionSeriesCheckedOutId FROM Document WHERE VersionSeriesCheckedOutId IS NOT NULL", 0, false, "ObjectId", new String(), true); - testQuery("SELECT VersionSeriesCheckedOutId FROM Document WHERE VersionSeriesCheckedOutId IS NULL", 45, false, "ObjectId", new String(), true); + testQuery("SELECT VersionSeriesCheckedOutId FROM Document WHERE VersionSeriesCheckedOutId IS NULL", 10, false, "ObjectId", new String(), true); testQuery("SELECT VersionSeriesCheckedOutId FROM Document WHERE 'admin' = ANY VersionSeriesCheckedOutId", 0, false, "ObjectId", new String(), true); - testQuery("SELECT VersionSeriesCheckedOutId FROM Document WHERE 'admin' <> ANY VersionSeriesCheckedOutId", 45, false, "ObjectId", new String(), true); + testQuery("SELECT VersionSeriesCheckedOutId FROM Document WHERE 'admin' <> ANY VersionSeriesCheckedOutId", 10, false, "ObjectId", new String(), true); testQuery("SELECT VersionSeriesCheckedOutId FROM Document WHERE 'admin' < ANY VersionSeriesCheckedOutId", 0, false, "ObjectId", new String(), true); testQuery("SELECT VersionSeriesCheckedOutId FROM Document WHERE 'admin' <= ANY VersionSeriesCheckedOutId", 0, false, "ObjectId", new String(), true); testQuery("SELECT VersionSeriesCheckedOutId FROM Document WHERE 'admin' > ANY VersionSeriesCheckedOutId", 0, false, "ObjectId", new String(), true); testQuery("SELECT VersionSeriesCheckedOutId FROM Document WHERE 'admin' >= ANY VersionSeriesCheckedOutId", 0, false, "ObjectId", new String(), true); testQuery("SELECT VersionSeriesCheckedOutId FROM Document WHERE ANY VersionSeriesCheckedOutId IN ('admin')", 0, false, "ObjectId", new String(), true); - testQuery("SELECT VersionSeriesCheckedOutId FROM Document WHERE ANY VersionSeriesCheckedOutId NOT IN ('admin')", 45, false, "ObjectId", new String(), true); + testQuery("SELECT VersionSeriesCheckedOutId FROM Document WHERE ANY VersionSeriesCheckedOutId NOT IN ('admin')", 10, false, "ObjectId", new String(), true); } - + public void test_VERSION_SERIES_CHECKED_OUT_BY() { testQuery("SELECT VersionSeriesCheckedOutBy FROM Document WHERE VersionSeriesCheckedOutBy = 'admin'", 0, false, "ObjectId", new String(), true); - testQuery("SELECT VersionSeriesCheckedOutBy FROM Document WHERE VersionSeriesCheckedOutBy <> 'admin'", 45, false, "ObjectId", new String(), true); + testQuery("SELECT VersionSeriesCheckedOutBy FROM Document WHERE VersionSeriesCheckedOutBy <> 'admin'", 10, false, "ObjectId", new String(), true); testQuery("SELECT VersionSeriesCheckedOutBy FROM Document WHERE VersionSeriesCheckedOutBy < 'admin'", 0, false, "ObjectId", new String(), true); testQuery("SELECT VersionSeriesCheckedOutBy FROM Document WHERE VersionSeriesCheckedOutBy <= 'admin'", 0, false, "ObjectId", new String(), true); testQuery("SELECT VersionSeriesCheckedOutBy FROM Document WHERE VersionSeriesCheckedOutBy > 'admin'", 0, false, "ObjectId", new String(), true); testQuery("SELECT VersionSeriesCheckedOutBy FROM Document WHERE VersionSeriesCheckedOutBy >= 'admin'", 0, false, "ObjectId", new String(), true); testQuery("SELECT VersionSeriesCheckedOutBy FROM Document WHERE VersionSeriesCheckedOutBy IN ('admin')", 0, false, "ObjectId", new String(), true); - testQuery("SELECT VersionSeriesCheckedOutBy FROM Document WHERE VersionSeriesCheckedOutBy NOT IN ('admin')", 45, false, "ObjectId", new String(), true); + testQuery("SELECT VersionSeriesCheckedOutBy FROM Document WHERE VersionSeriesCheckedOutBy NOT IN ('admin')", 10, false, "ObjectId", new String(), true); testQuery("SELECT VersionSeriesCheckedOutBy FROM Document WHERE VersionSeriesCheckedOutBy LIKE 'admin'", 0, false, "ObjectId", new String(), true); - testQuery("SELECT VersionSeriesCheckedOutBy FROM Document WHERE VersionSeriesCheckedOutBy NOT LIKE 'admin'", 45, false, "ObjectId", new String(), true); + testQuery("SELECT VersionSeriesCheckedOutBy FROM Document WHERE VersionSeriesCheckedOutBy NOT LIKE 'admin'", 10, false, "ObjectId", new String(), true); testQuery("SELECT VersionSeriesCheckedOutBy FROM Document WHERE VersionSeriesCheckedOutBy IS NOT NULL", 0, false, "ObjectId", new String(), true); - testQuery("SELECT VersionSeriesCheckedOutBy FROM Document WHERE VersionSeriesCheckedOutBy IS NULL", 45, false, "ObjectId", new String(), true); + testQuery("SELECT VersionSeriesCheckedOutBy FROM Document WHERE VersionSeriesCheckedOutBy IS NULL", 10, false, "ObjectId", new String(), true); testQuery("SELECT VersionSeriesCheckedOutBy FROM Document WHERE 'admin' = ANY VersionSeriesCheckedOutBy", 0, false, "ObjectId", new String(), true); - testQuery("SELECT VersionSeriesCheckedOutBy FROM Document WHERE 'admin' <> ANY VersionSeriesCheckedOutBy", 45, false, "ObjectId", new String(), true); + testQuery("SELECT VersionSeriesCheckedOutBy FROM Document WHERE 'admin' <> ANY VersionSeriesCheckedOutBy", 10, false, "ObjectId", new String(), true); testQuery("SELECT VersionSeriesCheckedOutBy FROM Document WHERE 'admin' < ANY VersionSeriesCheckedOutBy", 0, false, "ObjectId", new String(), true); testQuery("SELECT VersionSeriesCheckedOutBy FROM Document WHERE 'admin' <= ANY VersionSeriesCheckedOutBy", 0, false, "ObjectId", new String(), true); testQuery("SELECT VersionSeriesCheckedOutBy FROM Document WHERE 'admin' > ANY VersionSeriesCheckedOutBy", 0, false, "ObjectId", new String(), true); testQuery("SELECT VersionSeriesCheckedOutBy FROM Document WHERE 'admin' >= ANY VersionSeriesCheckedOutBy", 0, false, "ObjectId", new String(), true); testQuery("SELECT VersionSeriesCheckedOutBy FROM Document WHERE ANY VersionSeriesCheckedOutBy IN ('admin')", 0, false, "ObjectId", new String(), true); - testQuery("SELECT VersionSeriesCheckedOutBy FROM Document WHERE ANY VersionSeriesCheckedOutBy NOT IN ('admin')", 45, false, "ObjectId", new String(), true); + testQuery("SELECT VersionSeriesCheckedOutBy FROM Document WHERE ANY VersionSeriesCheckedOutBy NOT IN ('admin')", 10, false, "ObjectId", new String(), true); } - public void test_VERSION_SERIES_IS_CHECKED_OUT() { testQuery("SELECT IsVeriesSeriesCheckedOut FROM Document WHERE IsVeriesSeriesCheckedOut = 'TRUE'", 0, false, "ObjectId", new String(), true); - testQuery("SELECT IsVeriesSeriesCheckedOut FROM Document WHERE IsVeriesSeriesCheckedOut <> 'TRUE'", 45, false, "ObjectId", new String(), true); + testQuery("SELECT IsVeriesSeriesCheckedOut FROM Document WHERE IsVeriesSeriesCheckedOut <> 'TRUE'", 10, false, "ObjectId", new String(), true); testQuery("SELECT IsVeriesSeriesCheckedOut FROM Document WHERE IsVeriesSeriesCheckedOut < 'TRUE'", 0, false, "ObjectId", new String(), true); testQuery("SELECT IsVeriesSeriesCheckedOut FROM Document WHERE IsVeriesSeriesCheckedOut <= 'TRUE'", 0, false, "ObjectId", new String(), true); testQuery("SELECT IsVeriesSeriesCheckedOut FROM Document WHERE IsVeriesSeriesCheckedOut > 'TRUE'", 0, false, "ObjectId", new String(), true); testQuery("SELECT IsVeriesSeriesCheckedOut FROM Document WHERE IsVeriesSeriesCheckedOut >= 'TRUE'", 0, false, "ObjectId", new String(), true); testQuery("SELECT IsVeriesSeriesCheckedOut FROM Document WHERE IsVeriesSeriesCheckedOut IN ('TRUE')", 0, false, "ObjectId", new String(), true); - testQuery("SELECT IsVeriesSeriesCheckedOut FROM Document WHERE IsVeriesSeriesCheckedOut NOT IN ('TRUE')", 45, false, "ObjectId", new String(), true); + testQuery("SELECT IsVeriesSeriesCheckedOut FROM Document WHERE IsVeriesSeriesCheckedOut NOT IN ('TRUE')", 10, false, "ObjectId", new String(), true); testQuery("SELECT IsVeriesSeriesCheckedOut FROM Document WHERE IsVeriesSeriesCheckedOut LIKE 'TRUE'", 0, false, "ObjectId", new String(), true); - testQuery("SELECT IsVeriesSeriesCheckedOut FROM Document WHERE IsVeriesSeriesCheckedOut NOT LIKE 'TRUE'", 45, false, "ObjectId", new String(), true); + testQuery("SELECT IsVeriesSeriesCheckedOut FROM Document WHERE IsVeriesSeriesCheckedOut NOT LIKE 'TRUE'", 10, false, "ObjectId", new String(), true); testQuery("SELECT IsVeriesSeriesCheckedOut FROM Document WHERE IsVeriesSeriesCheckedOut IS NOT NULL", 0, false, "ObjectId", new String(), true); - testQuery("SELECT IsVeriesSeriesCheckedOut FROM Document WHERE IsVeriesSeriesCheckedOut IS NULL", 45, false, "ObjectId", new String(), true); + testQuery("SELECT IsVeriesSeriesCheckedOut FROM Document WHERE IsVeriesSeriesCheckedOut IS NULL", 10, false, "ObjectId", new String(), true); testQuery("SELECT IsVeriesSeriesCheckedOut FROM Document WHERE 'TRUE' = ANY IsVeriesSeriesCheckedOut", 0, false, "ObjectId", new String(), true); - testQuery("SELECT IsVeriesSeriesCheckedOut FROM Document WHERE 'TRUE' <> ANY IsVeriesSeriesCheckedOut", 45, false, "ObjectId", new String(), true); + testQuery("SELECT IsVeriesSeriesCheckedOut FROM Document WHERE 'TRUE' <> ANY IsVeriesSeriesCheckedOut", 10, false, "ObjectId", new String(), true); testQuery("SELECT IsVeriesSeriesCheckedOut FROM Document WHERE 'TRUE' < ANY IsVeriesSeriesCheckedOut", 0, false, "ObjectId", new String(), true); testQuery("SELECT IsVeriesSeriesCheckedOut FROM Document WHERE 'TRUE' <= ANY IsVeriesSeriesCheckedOut", 0, false, "ObjectId", new String(), true); testQuery("SELECT IsVeriesSeriesCheckedOut FROM Document WHERE 'TRUE' > ANY IsVeriesSeriesCheckedOut", 0, false, "ObjectId", new String(), true); testQuery("SELECT IsVeriesSeriesCheckedOut FROM Document WHERE 'TRUE' >= ANY IsVeriesSeriesCheckedOut", 0, false, "ObjectId", new String(), true); testQuery("SELECT IsVeriesSeriesCheckedOut FROM Document WHERE ANY IsVeriesSeriesCheckedOut IN ('TRUE')", 0, false, "ObjectId", new String(), true); - testQuery("SELECT IsVeriesSeriesCheckedOut FROM Document WHERE ANY IsVeriesSeriesCheckedOut NOT IN ('TRUE')", 45, false, "ObjectId", new String(), true); + testQuery("SELECT IsVeriesSeriesCheckedOut FROM Document WHERE ANY IsVeriesSeriesCheckedOut NOT IN ('TRUE')", 10, false, "ObjectId", new String(), true); } - - + public void test_VERSION_SERIES_ID() { testQuery("SELECT VersionSeriesId FROM Document WHERE VersionSeriesId = 'company'", 0, false, "ObjectId", new String(), true); - testQuery("SELECT VersionSeriesId FROM Document WHERE VersionSeriesId <> 'company'", 45, false, "ObjectId", new String(), true); + testQuery("SELECT VersionSeriesId FROM Document WHERE VersionSeriesId <> 'company'", 10, false, "ObjectId", new String(), true); testQuery("SELECT VersionSeriesId FROM Document WHERE VersionSeriesId < 'company'", 0, false, "ObjectId", new String(), true); testQuery("SELECT VersionSeriesId FROM Document WHERE VersionSeriesId <= 'company'", 0, false, "ObjectId", new String(), true); testQuery("SELECT VersionSeriesId FROM Document WHERE VersionSeriesId > 'company'", 0, false, "ObjectId", new String(), true); testQuery("SELECT VersionSeriesId FROM Document WHERE VersionSeriesId >= 'company'", 0, false, "ObjectId", new String(), true); testQuery("SELECT VersionSeriesId FROM Document WHERE VersionSeriesId IN ('company')", 0, false, "ObjectId", new String(), true); - testQuery("SELECT VersionSeriesId FROM Document WHERE VersionSeriesId NOT IN ('company')", 45, false, "ObjectId", new String(), true); + testQuery("SELECT VersionSeriesId FROM Document WHERE VersionSeriesId NOT IN ('company')", 10, false, "ObjectId", new String(), true); testQuery("SELECT VersionSeriesId FROM Document WHERE VersionSeriesId LIKE 'company'", 0, false, "ObjectId", new String(), true); - testQuery("SELECT VersionSeriesId FROM Document WHERE VersionSeriesId NOT LIKE 'company'", 45, false, "ObjectId", new String(), true); + testQuery("SELECT VersionSeriesId FROM Document WHERE VersionSeriesId NOT LIKE 'company'", 10, false, "ObjectId", new String(), true); testQuery("SELECT VersionSeriesId FROM Document WHERE VersionSeriesId IS NOT NULL", 0, false, "ObjectId", new String(), true); - testQuery("SELECT VersionSeriesId FROM Document WHERE VersionSeriesId IS NULL", 45, false, "ObjectId", new String(), true); + testQuery("SELECT VersionSeriesId FROM Document WHERE VersionSeriesId IS NULL", 10, false, "ObjectId", new String(), true); testQuery("SELECT VersionSeriesId FROM Document WHERE 'company' = ANY VersionSeriesId", 0, false, "ObjectId", new String(), true); - testQuery("SELECT VersionSeriesId FROM Document WHERE 'company' <> ANY VersionSeriesId", 45, false, "ObjectId", new String(), true); + testQuery("SELECT VersionSeriesId FROM Document WHERE 'company' <> ANY VersionSeriesId", 10, false, "ObjectId", new String(), true); testQuery("SELECT VersionSeriesId FROM Document WHERE 'company' < ANY VersionSeriesId", 0, false, "ObjectId", new String(), true); testQuery("SELECT VersionSeriesId FROM Document WHERE 'company' <= ANY VersionSeriesId", 0, false, "ObjectId", new String(), true); testQuery("SELECT VersionSeriesId FROM Document WHERE 'company' > ANY VersionSeriesId", 0, false, "ObjectId", new String(), true); testQuery("SELECT VersionSeriesId FROM Document WHERE 'company' >= ANY VersionSeriesId", 0, false, "ObjectId", new String(), true); testQuery("SELECT VersionSeriesId FROM Document WHERE ANY VersionSeriesId IN ('company')", 0, false, "ObjectId", new String(), true); - testQuery("SELECT VersionSeriesId FROM Document WHERE ANY VersionSeriesId NOT IN ('company')", 45, false, "ObjectId", new String(), true); + testQuery("SELECT VersionSeriesId FROM Document WHERE ANY VersionSeriesId NOT IN ('company')", 10, false, "ObjectId", new String(), true); } public void test_VERSION_LABEL() { testQuery("SELECT VersionLabel FROM Document WHERE VersionLabel = 'company'", 0, false, "ObjectId", new String(), false); - testQuery("SELECT VersionLabel FROM Document WHERE VersionLabel <> 'company'", 45, false, "ObjectId", new String(), false); + testQuery("SELECT VersionLabel FROM Document WHERE VersionLabel <> 'company'", 10, false, "ObjectId", new String(), false); testQuery("SELECT VersionLabel FROM Document WHERE VersionLabel < 'company'", 0, false, "ObjectId", new String(), false); testQuery("SELECT VersionLabel FROM Document WHERE VersionLabel <= 'company'", 0, false, "ObjectId", new String(), false); testQuery("SELECT VersionLabel FROM Document WHERE VersionLabel > 'company'", 0, false, "ObjectId", new String(), false); testQuery("SELECT VersionLabel FROM Document WHERE VersionLabel >= 'company'", 0, false, "ObjectId", new String(), false); testQuery("SELECT VersionLabel FROM Document WHERE VersionLabel IN ('company')", 0, false, "ObjectId", new String(), false); - testQuery("SELECT VersionLabel FROM Document WHERE VersionLabel NOT IN ('company')", 45, false, "ObjectId", new String(), false); + testQuery("SELECT VersionLabel FROM Document WHERE VersionLabel NOT IN ('company')", 10, false, "ObjectId", new String(), false); testQuery("SELECT VersionLabel FROM Document WHERE VersionLabel LIKE 'company'", 0, false, "ObjectId", new String(), false); - testQuery("SELECT VersionLabel FROM Document WHERE VersionLabel NOT LIKE 'company'", 45, false, "ObjectId", new String(), false); + testQuery("SELECT VersionLabel FROM Document WHERE VersionLabel NOT LIKE 'company'", 10, false, "ObjectId", new String(), false); testQuery("SELECT VersionLabel FROM Document WHERE VersionLabel IS NOT NULL", 0, false, "ObjectId", new String(), false); - testQuery("SELECT VersionLabel FROM Document WHERE VersionLabel IS NULL", 45, false, "ObjectId", new String(), false); + testQuery("SELECT VersionLabel FROM Document WHERE VersionLabel IS NULL", 10, false, "ObjectId", new String(), false); testQuery("SELECT VersionLabel FROM Document WHERE 'company' = ANY VersionLabel", 0, false, "ObjectId", new String(), false); - testQuery("SELECT VersionLabel FROM Document WHERE 'company' <> ANY VersionLabel", 45, false, "ObjectId", new String(), false); + testQuery("SELECT VersionLabel FROM Document WHERE 'company' <> ANY VersionLabel", 10, false, "ObjectId", new String(), false); testQuery("SELECT VersionLabel FROM Document WHERE 'company' < ANY VersionLabel", 0, false, "ObjectId", new String(), false); testQuery("SELECT VersionLabel FROM Document WHERE 'company' <= ANY VersionLabel", 0, false, "ObjectId", new String(), false); testQuery("SELECT VersionLabel FROM Document WHERE 'company' > ANY VersionLabel", 0, false, "ObjectId", new String(), false); testQuery("SELECT VersionLabel FROM Document WHERE 'company' >= ANY VersionLabel", 0, false, "ObjectId", new String(), false); testQuery("SELECT VersionLabel FROM Document WHERE ANY VersionLabel IN ('company')", 0, false, "ObjectId", new String(), false); - testQuery("SELECT VersionLabel FROM Document WHERE ANY VersionLabel NOT IN ('company')", 45, false, "ObjectId", new String(), false); + testQuery("SELECT VersionLabel FROM Document WHERE ANY VersionLabel NOT IN ('company')", 10, false, "ObjectId", new String(), false); } public void test_IS_LATEST_MAJOR_VERSION() { - testQuery("SELECT IsLatestMajorVersion FROM Document WHERE IsLatestMajorVersion = 'TRUE'", 1, false, "ObjectId", new String(), true); - testQuery("SELECT IsLatestMajorVersion FROM Document WHERE IsLatestMajorVersion <> 'TRUE'", 32, false, "ObjectId", new String(), true); - testQuery("SELECT IsLatestMajorVersion FROM Document WHERE IsLatestMajorVersion < 'TRUE'", 6, false, "ObjectId", new String(), true); - testQuery("SELECT IsLatestMajorVersion FROM Document WHERE IsLatestMajorVersion <= 'TRUE'", 7, false, "ObjectId", new String(), true); - testQuery("SELECT IsLatestMajorVersion FROM Document WHERE IsLatestMajorVersion > 'TRUE'", 30, false, "ObjectId", new String(), true); - testQuery("SELECT IsLatestMajorVersion FROM Document WHERE IsLatestMajorVersion >= 'TRUE'", 30, false, "ObjectId", new String(), true); + testQuery("SELECT IsLatestMajorVersion FROM Document WHERE IsLatestMajorVersion = 'TRUE'", 0, false, "ObjectId", new String(), true); + testQuery("SELECT IsLatestMajorVersion FROM Document WHERE IsLatestMajorVersion <> 'TRUE'", 0, false, "ObjectId", new String(), true); + testQuery("SELECT IsLatestMajorVersion FROM Document WHERE IsLatestMajorVersion < 'TRUE'", 0, false, "ObjectId", new String(), true); + testQuery("SELECT IsLatestMajorVersion FROM Document WHERE IsLatestMajorVersion <= 'TRUE'", 0, false, "ObjectId", new String(), true); + testQuery("SELECT IsLatestMajorVersion FROM Document WHERE IsLatestMajorVersion > 'TRUE'", 0, false, "ObjectId", new String(), true); + testQuery("SELECT IsLatestMajorVersion FROM Document WHERE IsLatestMajorVersion >= 'TRUE'", 0, false, "ObjectId", new String(), true); - testQuery("SELECT IsLatestMajorVersion FROM Document WHERE IsLatestMajorVersion IN ('TRUE')", 1, false, "ObjectId", new String(), true); - testQuery("SELECT IsLatestMajorVersion FROM Document WHERE IsLatestMajorVersion NOT IN ('TRUE')", 32, false, "ObjectId", new String(), true); + testQuery("SELECT IsLatestMajorVersion FROM Document WHERE IsLatestMajorVersion IN ('TRUE')", 0, false, "ObjectId", new String(), true); + testQuery("SELECT IsLatestMajorVersion FROM Document WHERE IsLatestMajorVersion NOT IN ('TRUE')", 0, false, "ObjectId", new String(), true); - testQuery("SELECT IsLatestMajorVersion FROM Document WHERE IsLatestMajorVersion LIKE 'TRUE'", 1, false, "ObjectId", new String(), true); - testQuery("SELECT IsLatestMajorVersion FROM Document WHERE IsLatestMajorVersion NOT LIKE 'TRUE'", 32, false, "ObjectId", new String(), true); + testQuery("SELECT IsLatestMajorVersion FROM Document WHERE IsLatestMajorVersion LIKE 'TRUE'", 0, false, "ObjectId", new String(), true); + testQuery("SELECT IsLatestMajorVersion FROM Document WHERE IsLatestMajorVersion NOT LIKE 'TRUE'", 0, false, "ObjectId", new String(), true); - testQuery("SELECT IsLatestMajorVersion FROM Document WHERE IsLatestMajorVersion IS NOT NULL", 33, false, "ObjectId", new String(), true); + testQuery("SELECT IsLatestMajorVersion FROM Document WHERE IsLatestMajorVersion IS NOT NULL", 0, false, "ObjectId", new String(), true); testQuery("SELECT IsLatestMajorVersion FROM Document WHERE IsLatestMajorVersion IS NULL", 0, false, "ObjectId", new String(), true); - testQuery("SELECT IsLatestMajorVersion FROM Document WHERE 'TRUE' = ANY IsLatestMajorVersion", 1, false, "ObjectId", new String(), true); - testQuery("SELECT IsLatestMajorVersion FROM Document WHERE 'TRUE' <> ANY IsLatestMajorVersion", 32, false, "ObjectId", new String(), true); - testQuery("SELECT IsLatestMajorVersion FROM Document WHERE 'TRUE' < ANY IsLatestMajorVersion", 6, false, "ObjectId", new String(), true); - testQuery("SELECT IsLatestMajorVersion FROM Document WHERE 'TRUE' <= ANY IsLatestMajorVersion", 7, false, "ObjectId", new String(), true); - testQuery("SELECT IsLatestMajorVersion FROM Document WHERE 'TRUE' > ANY IsLatestMajorVersion", 30, false, "ObjectId", new String(), true); - testQuery("SELECT IsLatestMajorVersion FROM Document WHERE 'TRUE' >= ANY IsLatestMajorVersion", 30, false, "ObjectId", new String(), true); + testQuery("SELECT IsLatestMajorVersion FROM Document WHERE 'TRUE' = ANY IsLatestMajorVersion", 0, false, "ObjectId", new String(), true); + testQuery("SELECT IsLatestMajorVersion FROM Document WHERE 'TRUE' <> ANY IsLatestMajorVersion", 0, false, "ObjectId", new String(), true); + testQuery("SELECT IsLatestMajorVersion FROM Document WHERE 'TRUE' < ANY IsLatestMajorVersion", 0, false, "ObjectId", new String(), true); + testQuery("SELECT IsLatestMajorVersion FROM Document WHERE 'TRUE' <= ANY IsLatestMajorVersion", 0, false, "ObjectId", new String(), true); + testQuery("SELECT IsLatestMajorVersion FROM Document WHERE 'TRUE' > ANY IsLatestMajorVersion", 0, false, "ObjectId", new String(), true); + testQuery("SELECT IsLatestMajorVersion FROM Document WHERE 'TRUE' >= ANY IsLatestMajorVersion", 0, false, "ObjectId", new String(), true); - testQuery("SELECT IsLatestMajorVersion FROM Document WHERE ANY IsLatestMajorVersion IN ('TRUE')", 1, false, "ObjectId", new String(), true); - testQuery("SELECT IsLatestMajorVersion FROM Document WHERE ANY IsLatestMajorVersion NOT IN ('TRUE')", 32, false, "ObjectId", new String(), true); + testQuery("SELECT IsLatestMajorVersion FROM Document WHERE ANY IsLatestMajorVersion IN ('TRUE')", 0, false, "ObjectId", new String(), true); + testQuery("SELECT IsLatestMajorVersion FROM Document WHERE ANY IsLatestMajorVersion NOT IN ('TRUE')", 0, false, "ObjectId", new String(), true); } public void test_IS_MAJOR_VERSION() { - testQuery("SELECT IsMajorVersion FROM Document WHERE IsMajorVersion = 'TRUE'", 1, false, "ObjectId", new String(), true); - testQuery("SELECT IsMajorVersion FROM Document WHERE IsMajorVersion <> 'TRUE'", 32, false, "ObjectId", new String(), true); - testQuery("SELECT IsMajorVersion FROM Document WHERE IsMajorVersion < 'TRUE'", 6, false, "ObjectId", new String(), true); - testQuery("SELECT IsMajorVersion FROM Document WHERE IsMajorVersion <= 'TRUE'", 7, false, "ObjectId", new String(), true); - testQuery("SELECT IsMajorVersion FROM Document WHERE IsMajorVersion > 'TRUE'", 30, false, "ObjectId", new String(), true); - testQuery("SELECT IsMajorVersion FROM Document WHERE IsMajorVersion >= 'TRUE'", 30, false, "ObjectId", new String(), true); + testQuery("SELECT IsMajorVersion FROM Document WHERE IsMajorVersion = 'TRUE'", 0, false, "ObjectId", new String(), true); + testQuery("SELECT IsMajorVersion FROM Document WHERE IsMajorVersion <> 'TRUE'", 0, false, "ObjectId", new String(), true); + testQuery("SELECT IsMajorVersion FROM Document WHERE IsMajorVersion < 'TRUE'", 0, false, "ObjectId", new String(), true); + testQuery("SELECT IsMajorVersion FROM Document WHERE IsMajorVersion <= 'TRUE'", 0, false, "ObjectId", new String(), true); + testQuery("SELECT IsMajorVersion FROM Document WHERE IsMajorVersion > 'TRUE'", 0, false, "ObjectId", new String(), true); + testQuery("SELECT IsMajorVersion FROM Document WHERE IsMajorVersion >= 'TRUE'", 0, false, "ObjectId", new String(), true); - testQuery("SELECT IsMajorVersion FROM Document WHERE IsMajorVersion IN ('TRUE')", 1, false, "ObjectId", new String(), true); - testQuery("SELECT IsMajorVersion FROM Document WHERE IsMajorVersion NOT IN ('TRUE')", 32, false, "ObjectId", new String(), true); + testQuery("SELECT IsMajorVersion FROM Document WHERE IsMajorVersion IN ('TRUE')", 0, false, "ObjectId", new String(), true); + testQuery("SELECT IsMajorVersion FROM Document WHERE IsMajorVersion NOT IN ('TRUE')", 0, false, "ObjectId", new String(), true); - testQuery("SELECT IsMajorVersion FROM Document WHERE IsMajorVersion LIKE 'TRUE'", 1, false, "ObjectId", new String(), true); - testQuery("SELECT IsMajorVersion FROM Document WHERE IsMajorVersion NOT LIKE 'TRUE'", 32, false, "ObjectId", new String(), true); + testQuery("SELECT IsMajorVersion FROM Document WHERE IsMajorVersion LIKE 'TRUE'", 0, false, "ObjectId", new String(), true); + testQuery("SELECT IsMajorVersion FROM Document WHERE IsMajorVersion NOT LIKE 'TRUE'", 0, false, "ObjectId", new String(), true); - testQuery("SELECT IsMajorVersion FROM Document WHERE IsMajorVersion IS NOT NULL", 33, false, "ObjectId", new String(), true); + testQuery("SELECT IsMajorVersion FROM Document WHERE IsMajorVersion IS NOT NULL", 0, false, "ObjectId", new String(), true); testQuery("SELECT IsMajorVersion FROM Document WHERE IsMajorVersion IS NULL", 0, false, "ObjectId", new String(), true); - testQuery("SELECT IsMajorVersion FROM Document WHERE 'TRUE' = ANY IsMajorVersion", 1, false, "ObjectId", new String(), true); - testQuery("SELECT IsMajorVersion FROM Document WHERE 'TRUE' <> ANY IsMajorVersion", 32, false, "ObjectId", new String(), true); - testQuery("SELECT IsMajorVersion FROM Document WHERE 'TRUE' < ANY IsMajorVersion", 6, false, "ObjectId", new String(), true); - testQuery("SELECT IsMajorVersion FROM Document WHERE 'TRUE' <= ANY IsMajorVersion", 7, false, "ObjectId", new String(), true); - testQuery("SELECT IsMajorVersion FROM Document WHERE 'TRUE' > ANY IsMajorVersion", 30, false, "ObjectId", new String(), true); - testQuery("SELECT IsMajorVersion FROM Document WHERE 'TRUE' >= ANY IsMajorVersion", 30, false, "ObjectId", new String(), true); + testQuery("SELECT IsMajorVersion FROM Document WHERE 'TRUE' = ANY IsMajorVersion", 0, false, "ObjectId", new String(), true); + testQuery("SELECT IsMajorVersion FROM Document WHERE 'TRUE' <> ANY IsMajorVersion", 0, false, "ObjectId", new String(), true); + testQuery("SELECT IsMajorVersion FROM Document WHERE 'TRUE' < ANY IsMajorVersion", 0, false, "ObjectId", new String(), true); + testQuery("SELECT IsMajorVersion FROM Document WHERE 'TRUE' <= ANY IsMajorVersion", 0, false, "ObjectId", new String(), true); + testQuery("SELECT IsMajorVersion FROM Document WHERE 'TRUE' > ANY IsMajorVersion", 0, false, "ObjectId", new String(), true); + testQuery("SELECT IsMajorVersion FROM Document WHERE 'TRUE' >= ANY IsMajorVersion", 0, false, "ObjectId", new String(), true); - testQuery("SELECT IsMajorVersion FROM Document WHERE ANY IsMajorVersion IN ('TRUE')", 1, false, "ObjectId", new String(), true); - testQuery("SELECT IsMajorVersion FROM Document WHERE ANY IsMajorVersion NOT IN ('TRUE')", 32, false, "ObjectId", new String(), true); + testQuery("SELECT IsMajorVersion FROM Document WHERE ANY IsMajorVersion IN ('TRUE')", 0, false, "ObjectId", new String(), true); + testQuery("SELECT IsMajorVersion FROM Document WHERE ANY IsMajorVersion NOT IN ('TRUE')", 0, false, "ObjectId", new String(), true); } public void test_IS_LATEST_VERSION() { - testQuery("SELECT IsLatestVersion FROM Document WHERE IsLatestVersion = 'TRUE'", 1, false, "ObjectId", new String(), true); - testQuery("SELECT IsLatestVersion FROM Document WHERE IsLatestVersion <> 'TRUE'", 32, false, "ObjectId", new String(), true); - testQuery("SELECT IsLatestVersion FROM Document WHERE IsLatestVersion < 'TRUE'", 6, false, "ObjectId", new String(), true); - testQuery("SELECT IsLatestVersion FROM Document WHERE IsLatestVersion <= 'TRUE'", 7, false, "ObjectId", new String(), true); - testQuery("SELECT IsLatestVersion FROM Document WHERE IsLatestVersion > 'TRUE'", 30, false, "ObjectId", new String(), true); - testQuery("SELECT IsLatestVersion FROM Document WHERE IsLatestVersion >= 'TRUE'", 30, false, "ObjectId", new String(), true); + testQuery("SELECT IsLatestVersion FROM Document WHERE IsLatestVersion = 'TRUE'", 0, false, "ObjectId", new String(), true); + testQuery("SELECT IsLatestVersion FROM Document WHERE IsLatestVersion <> 'TRUE'", 0, false, "ObjectId", new String(), true); + testQuery("SELECT IsLatestVersion FROM Document WHERE IsLatestVersion < 'TRUE'", 0, false, "ObjectId", new String(), true); + testQuery("SELECT IsLatestVersion FROM Document WHERE IsLatestVersion <= 'TRUE'", 0, false, "ObjectId", new String(), true); + testQuery("SELECT IsLatestVersion FROM Document WHERE IsLatestVersion > 'TRUE'", 0, false, "ObjectId", new String(), true); + testQuery("SELECT IsLatestVersion FROM Document WHERE IsLatestVersion >= 'TRUE'", 0, false, "ObjectId", new String(), true); - testQuery("SELECT IsLatestVersion FROM Document WHERE IsLatestVersion IN ('TRUE')", 1, false, "ObjectId", new String(), true); - testQuery("SELECT IsLatestVersion FROM Document WHERE IsLatestVersion NOT IN ('TRUE')", 32, false, "ObjectId", new String(), true); + testQuery("SELECT IsLatestVersion FROM Document WHERE IsLatestVersion IN ('TRUE')", 0, false, "ObjectId", new String(), true); + testQuery("SELECT IsLatestVersion FROM Document WHERE IsLatestVersion NOT IN ('TRUE')", 0, false, "ObjectId", new String(), true); - testQuery("SELECT IsLatestVersion FROM Document WHERE IsLatestVersion LIKE 'TRUE'", 1, false, "ObjectId", new String(), true); - testQuery("SELECT IsLatestVersion FROM Document WHERE IsLatestVersion NOT LIKE 'TRUE'", 32, false, "ObjectId", new String(), true); + testQuery("SELECT IsLatestVersion FROM Document WHERE IsLatestVersion LIKE 'TRUE'", 0, false, "ObjectId", new String(), true); + testQuery("SELECT IsLatestVersion FROM Document WHERE IsLatestVersion NOT LIKE 'TRUE'", 0, false, "ObjectId", new String(), true); - testQuery("SELECT IsLatestVersion FROM Document WHERE IsLatestVersion IS NOT NULL", 33, false, "ObjectId", new String(), true); + testQuery("SELECT IsLatestVersion FROM Document WHERE IsLatestVersion IS NOT NULL", 0, false, "ObjectId", new String(), true); testQuery("SELECT IsLatestVersion FROM Document WHERE IsLatestVersion IS NULL", 0, false, "ObjectId", new String(), true); - testQuery("SELECT IsLatestVersion FROM Document WHERE 'TRUE' = ANY IsLatestVersion", 1, false, "ObjectId", new String(), true); - testQuery("SELECT IsLatestVersion FROM Document WHERE 'TRUE' <> ANY IsLatestVersion", 32, false, "ObjectId", new String(), true); - testQuery("SELECT IsLatestVersion FROM Document WHERE 'TRUE' < ANY IsLatestVersion", 6, false, "ObjectId", new String(), true); - testQuery("SELECT IsLatestVersion FROM Document WHERE 'TRUE' <= ANY IsLatestVersion", 7, false, "ObjectId", new String(), true); - testQuery("SELECT IsLatestVersion FROM Document WHERE 'TRUE' > ANY IsLatestVersion", 30, false, "ObjectId", new String(), true); - testQuery("SELECT IsLatestVersion FROM Document WHERE 'TRUE' >= ANY IsLatestVersion", 30, false, "ObjectId", new String(), true); + testQuery("SELECT IsLatestVersion FROM Document WHERE 'TRUE' = ANY IsLatestVersion", 0, false, "ObjectId", new String(), true); + testQuery("SELECT IsLatestVersion FROM Document WHERE 'TRUE' <> ANY IsLatestVersion", 0, false, "ObjectId", new String(), true); + testQuery("SELECT IsLatestVersion FROM Document WHERE 'TRUE' < ANY IsLatestVersion", 0, false, "ObjectId", new String(), true); + testQuery("SELECT IsLatestVersion FROM Document WHERE 'TRUE' <= ANY IsLatestVersion", 0, false, "ObjectId", new String(), true); + testQuery("SELECT IsLatestVersion FROM Document WHERE 'TRUE' > ANY IsLatestVersion", 0, false, "ObjectId", new String(), true); + testQuery("SELECT IsLatestVersion FROM Document WHERE 'TRUE' >= ANY IsLatestVersion", 0, false, "ObjectId", new String(), true); - testQuery("SELECT IsLatestVersion FROM Document WHERE ANY IsLatestVersion IN ('TRUE')", 1, false, "ObjectId", new String(), true); - testQuery("SELECT IsLatestVersion FROM Document WHERE ANY IsLatestVersion NOT IN ('TRUE')", 32, false, "ObjectId", new String(), true); + testQuery("SELECT IsLatestVersion FROM Document WHERE ANY IsLatestVersion IN ('TRUE')", 0, false, "ObjectId", new String(), true); + testQuery("SELECT IsLatestVersion FROM Document WHERE ANY IsLatestVersion NOT IN ('TRUE')", 0, false, "ObjectId", new String(), true); } public void test_IS_IMMUTABLE() { - testQuery("SELECT IsImmutable FROM Document WHERE IsImmutable = 'TRUE'", 1, false, "ObjectId", new String(), true); - testQuery("SELECT IsImmutable FROM Document WHERE IsImmutable <> 'TRUE'", 32, false, "ObjectId", new String(), true); - testQuery("SELECT IsImmutable FROM Document WHERE IsImmutable < 'TRUE'", 6, false, "ObjectId", new String(), true); - testQuery("SELECT IsImmutable FROM Document WHERE IsImmutable <= 'TRUE'", 7, false, "ObjectId", new String(), true); - testQuery("SELECT IsImmutable FROM Document WHERE IsImmutable > 'TRUE'", 30, false, "ObjectId", new String(), true); - testQuery("SELECT IsImmutable FROM Document WHERE IsImmutable >= 'TRUE'", 30, false, "ObjectId", new String(), true); + testQuery("SELECT IsImmutable FROM Document WHERE IsImmutable = 'TRUE'", 0, false, "ObjectId", new String(), true); + testQuery("SELECT IsImmutable FROM Document WHERE IsImmutable <> 'TRUE'", 0, false, "ObjectId", new String(), true); + testQuery("SELECT IsImmutable FROM Document WHERE IsImmutable < 'TRUE'", 0, false, "ObjectId", new String(), true); + testQuery("SELECT IsImmutable FROM Document WHERE IsImmutable <= 'TRUE'", 0, false, "ObjectId", new String(), true); + testQuery("SELECT IsImmutable FROM Document WHERE IsImmutable > 'TRUE'", 0, false, "ObjectId", new String(), true); + testQuery("SELECT IsImmutable FROM Document WHERE IsImmutable >= 'TRUE'", 0, false, "ObjectId", new String(), true); - testQuery("SELECT IsImmutable FROM Document WHERE IsImmutable IN ('TRUE')", 1, false, "ObjectId", new String(), true); - testQuery("SELECT IsImmutable FROM Document WHERE IsImmutable NOT IN ('TRUE')", 32, false, "ObjectId", new String(), true); + testQuery("SELECT IsImmutable FROM Document WHERE IsImmutable IN ('TRUE')", 0, false, "ObjectId", new String(), true); + testQuery("SELECT IsImmutable FROM Document WHERE IsImmutable NOT IN ('TRUE')", 0, false, "ObjectId", new String(), true); - testQuery("SELECT IsImmutable FROM Document WHERE IsImmutable LIKE 'TRUE'", 1, false, "ObjectId", new String(), true); - testQuery("SELECT IsImmutable FROM Document WHERE IsImmutable NOT LIKE 'TRUE'", 32, false, "ObjectId", new String(), true); + testQuery("SELECT IsImmutable FROM Document WHERE IsImmutable LIKE 'TRUE'", 0, false, "ObjectId", new String(), true); + testQuery("SELECT IsImmutable FROM Document WHERE IsImmutable NOT LIKE 'TRUE'", 0, false, "ObjectId", new String(), true); - testQuery("SELECT IsImmutable FROM Document WHERE IsImmutable IS NOT NULL", 33, false, "ObjectId", new String(), true); + testQuery("SELECT IsImmutable FROM Document WHERE IsImmutable IS NOT NULL", 0, false, "ObjectId", new String(), true); testQuery("SELECT IsImmutable FROM Document WHERE IsImmutable IS NULL", 0, false, "ObjectId", new String(), true); - testQuery("SELECT IsImmutable FROM Document WHERE 'TRUE' = ANY IsImmutable", 1, false, "ObjectId", new String(), true); - testQuery("SELECT IsImmutable FROM Document WHERE 'TRUE' <> ANY IsImmutable", 32, false, "ObjectId", new String(), true); - testQuery("SELECT IsImmutable FROM Document WHERE 'TRUE' < ANY IsImmutable", 6, false, "ObjectId", new String(), true); - testQuery("SELECT IsImmutable FROM Document WHERE 'TRUE' <= ANY IsImmutable", 7, false, "ObjectId", new String(), true); - testQuery("SELECT IsImmutable FROM Document WHERE 'TRUE' > ANY IsImmutable", 30, false, "ObjectId", new String(), true); - testQuery("SELECT IsImmutable FROM Document WHERE 'TRUE' >= ANY IsImmutable", 30, false, "ObjectId", new String(), true); + testQuery("SELECT IsImmutable FROM Document WHERE 'TRUE' = ANY IsImmutable", 0, false, "ObjectId", new String(), true); + testQuery("SELECT IsImmutable FROM Document WHERE 'TRUE' <> ANY IsImmutable", 0, false, "ObjectId", new String(), true); + testQuery("SELECT IsImmutable FROM Document WHERE 'TRUE' < ANY IsImmutable", 0, false, "ObjectId", new String(), true); + testQuery("SELECT IsImmutable FROM Document WHERE 'TRUE' <= ANY IsImmutable", 0, false, "ObjectId", new String(), true); + testQuery("SELECT IsImmutable FROM Document WHERE 'TRUE' > ANY IsImmutable", 0, false, "ObjectId", new String(), true); + testQuery("SELECT IsImmutable FROM Document WHERE 'TRUE' >= ANY IsImmutable", 0, false, "ObjectId", new String(), true); - testQuery("SELECT IsImmutable FROM Document WHERE ANY IsImmutable IN ('TRUE')", 1, false, "ObjectId", new String(), true); - testQuery("SELECT IsImmutable FROM Document WHERE ANY IsImmutable NOT IN ('TRUE')", 32, false, "ObjectId", new String(), true); + testQuery("SELECT IsImmutable FROM Document WHERE ANY IsImmutable IN ('TRUE')", 0, false, "ObjectId", new String(), true); + testQuery("SELECT IsImmutable FROM Document WHERE ANY IsImmutable NOT IN ('TRUE')", 0, false, "ObjectId", new String(), true); } public void test_folder_NAME() { - testQuery("SELECT Name FROM Folder WHERE Name = 'company'", 1, false, "ObjectId", new String(), false); - testQuery("SELECT Name FROM Folder WHERE Name <> 'company'", 32, false, "ObjectId", new String(), false); - testQuery("SELECT Name FROM Folder WHERE Name < 'company'", 6, false, "ObjectId", new String(), false); - testQuery("SELECT Name FROM Folder WHERE Name <= 'company'", 7, false, "ObjectId", new String(), false); - testQuery("SELECT Name FROM Folder WHERE Name > 'company'", 30, false, "ObjectId", new String(), false); - testQuery("SELECT Name FROM Folder WHERE Name >= 'company'", 30, false, "ObjectId", new String(), false); + testQuery("SELECT Name FROM Folder WHERE Name = 'Folder 1'", 1, false, "ObjectId", new String(), false); + testQuery("SELECT Name FROM Folder WHERE Name <> 'Folder 1'", 9, false, "ObjectId", new String(), false); + testQuery("SELECT Name FROM Folder WHERE Name < 'Folder 1'", 10, false, "ObjectId", new String(), false); + testQuery("SELECT Name FROM Folder WHERE Name <= 'Folder 1'", 10, false, "ObjectId", new String(), false); + testQuery("SELECT Name FROM Folder WHERE Name > 'Folder 1'", 0, false, "ObjectId", new String(), false); + testQuery("SELECT Name FROM Folder WHERE Name >= 'Folder 1'", 0, false, "ObjectId", new String(), false); - testQuery("SELECT Name FROM Folder WHERE Name IN ('company')", 1, false, "ObjectId", new String(), false); - testQuery("SELECT Name FROM Folder WHERE Name NOT IN ('company')", 32, false, "ObjectId", new String(), false); + testQuery("SELECT Name FROM Folder WHERE Name IN ('Folder 1')", 1, false, "ObjectId", new String(), false); + testQuery("SELECT Name FROM Folder WHERE Name NOT IN ('Folder 1')", 9, false, "ObjectId", new String(), false); - testQuery("SELECT Name FROM Folder WHERE Name LIKE 'company'", 1, false, "ObjectId", new String(), false); - testQuery("SELECT Name FROM Folder WHERE Name NOT LIKE 'company'", 32, false, "ObjectId", new String(), false); + testQuery("SELECT Name FROM Folder WHERE Name LIKE 'Folder 1'", 1, false, "ObjectId", new String(), false); + testQuery("SELECT Name FROM Folder WHERE Name NOT LIKE 'Folder 1'", 9, false, "ObjectId", new String(), false); - testQuery("SELECT Name FROM Folder WHERE Name IS NOT NULL", 33, false, "ObjectId", new String(), false); + testQuery("SELECT Name FROM Folder WHERE Name IS NOT NULL", 10, false, "ObjectId", new String(), false); testQuery("SELECT Name FROM Folder WHERE Name IS NULL", 0, false, "ObjectId", new String(), false); - testQuery("SELECT Name FROM Folder WHERE 'company' = ANY Name", 1, false, "ObjectId", new String(), false); - testQuery("SELECT Name FROM Folder WHERE 'company' <> ANY Name", 32, false, "ObjectId", new String(), false); - testQuery("SELECT Name FROM Folder WHERE 'company' < ANY Name", 6, false, "ObjectId", new String(), false); - testQuery("SELECT Name FROM Folder WHERE 'company' <= ANY Name", 7, false, "ObjectId", new String(), false); - testQuery("SELECT Name FROM Folder WHERE 'company' > ANY Name", 30, false, "ObjectId", new String(), false); - testQuery("SELECT Name FROM Folder WHERE 'company' >= ANY Name", 30, false, "ObjectId", new String(), false); + testQuery("SELECT Name FROM Folder WHERE 'Folder 1' = ANY Name", 1, false, "ObjectId", new String(), false); + testQuery("SELECT Name FROM Folder WHERE 'Folder 1' <> ANY Name", 9, false, "ObjectId", new String(), false); + testQuery("SELECT Name FROM Folder WHERE 'Folder 1' < ANY Name", 10, false, "ObjectId", new String(), false); + testQuery("SELECT Name FROM Folder WHERE 'Folder 1' <= ANY Name", 10, false, "ObjectId", new String(), false); + testQuery("SELECT Name FROM Folder WHERE 'Folder 1' > ANY Name", 0, false, "ObjectId", new String(), false); + testQuery("SELECT Name FROM Folder WHERE 'Folder 1' >= ANY Name", 0, false, "ObjectId", new String(), false); - testQuery("SELECT Name FROM Folder WHERE ANY Name IN ('company')", 1, false, "ObjectId", new String(), false); - testQuery("SELECT Name FROM Folder WHERE ANY Name NOT IN ('company')", 32, false, "ObjectId", new String(), false); + testQuery("SELECT Name FROM Folder WHERE ANY Name IN ('Folder 1')", 1, false, "ObjectId", new String(), false); + testQuery("SELECT Name FROM Folder WHERE ANY Name NOT IN ('Folder 1')", 9, false, "ObjectId", new String(), false); } public void test_document_Name() { - testQuery("SELECT Name FROM Document WHERE Name = 'tutorial'", 0, false, "Name", new String(), false); - testQuery("SELECT Name FROM Document WHERE Name <> 'tutorial'", 45, false, "Name", new String(), false); - testQuery("SELECT Name FROM Document WHERE Name < 'tutorial'", 45, false, "Name", new String(), false); - testQuery("SELECT Name FROM Document WHERE Name <= 'tutorial'", 45, false, "Name", new String(), false); - testQuery("SELECT Name FROM Document WHERE Name > 'tutorial'", 8, true, "Name", new String(), false); - testQuery("SELECT Name FROM Document WHERE Name >= 'tutorial'", 8, false, "Name", new String(), false); + testQuery("SELECT Name FROM Document WHERE Name = 'tutorial'", 1, false, "Name", new String(), false); + testQuery("SELECT Name FROM Document WHERE Name <> 'tutorial'", 9, false, "Name", new String(), false); + testQuery("SELECT Name FROM Document WHERE Name < 'tutorial'", 10, false, "Name", new String(), false); + testQuery("SELECT Name FROM Document WHERE Name <= 'tutorial'", 10, false, "Name", new String(), false); + testQuery("SELECT Name FROM Document WHERE Name > 'tutorial'", 0, true, "Name", new String(), false); + testQuery("SELECT Name FROM Document WHERE Name >= 'tutorial'", 1, false, "Name", new String(), false); - testQuery("SELECT Name FROM Document WHERE Name IN ('tutorial')", 0, false, "Name", new String(), false); - testQuery("SELECT Name FROM Document WHERE Name NOT IN ('tutorial')", 45, false, "Name", new String(), false); + testQuery("SELECT Name FROM Document WHERE Name IN ('tutorial')", 1, false, "Name", new String(), false); + testQuery("SELECT Name FROM Document WHERE Name NOT IN ('tutorial')", 9, false, "Name", new String(), false); - testQuery("SELECT Name FROM Document WHERE Name LIKE 'tutorial'", 0, false, "Name", new String(), false); - testQuery("SELECT Name FROM Document WHERE Name NOT LIKE 'tutorial'", 45, false, "Name", new String(), false); + testQuery("SELECT Name FROM Document WHERE Name LIKE 'tutorial'", 1, false, "Name", new String(), false); + testQuery("SELECT Name FROM Document WHERE Name NOT LIKE 'tutorial'", 9, false, "Name", new String(), false); - testQuery("SELECT Name FROM Document WHERE Name IS NOT NULL", 45, false, "Name", new String(), false); + testQuery("SELECT Name FROM Document WHERE Name IS NOT NULL", 10, false, "Name", new String(), false); testQuery("SELECT Name FROM Document WHERE Name IS NULL", 0, false, "Name", new String(), false); - testQuery("SELECT Name FROM Document WHERE 'tutorial' = ANY Name", 0, false, "Name", new String(), false); - testQuery("SELECT Name FROM Document WHERE 'tutorial' <> ANY Name", 45, false, "Name", new String(), false); - testQuery("SELECT Name FROM Document WHERE 'tutorial' < ANY Name", 45, false, "Name", new String(), false); - testQuery("SELECT Name FROM Document WHERE 'tutorial' <= ANY Name", 45, false, "Name", new String(), false); - testQuery("SELECT Name FROM Document WHERE 'tutorial' > ANY Name", 8, false, "Name", new String(), false); - testQuery("SELECT Name FROM Document WHERE 'tutorial' >= ANY Name", 8, false, "Name", new String(), false); + testQuery("SELECT Name FROM Document WHERE 'tutorial' = ANY Name", 1, false, "Name", new String(), false); + testQuery("SELECT Name FROM Document WHERE 'tutorial' <> ANY Name", 9, false, "Name", new String(), false); + testQuery("SELECT Name FROM Document WHERE 'tutorial' < ANY Name", 10, false, "Name", new String(), false); + testQuery("SELECT Name FROM Document WHERE 'tutorial' <= ANY Name", 10, false, "Name", new String(), false); + testQuery("SELECT Name FROM Document WHERE 'tutorial' > ANY Name", 0, false, "Name", new String(), false); + testQuery("SELECT Name FROM Document WHERE 'tutorial' >= ANY Name", 1, false, "Name", new String(), false); - testQuery("SELECT Name FROM Document WHERE ANY Name IN ('tutorial')", 0, false, "Name", new String(), false); - testQuery("SELECT Name FROM Document WHERE ANY Name NOT IN ('tutorial')", 45, false, "Name", new String(), false); + testQuery("SELECT Name FROM Document WHERE ANY Name IN ('tutorial')", 1, false, "Name", new String(), false); + testQuery("SELECT Name FROM Document WHERE ANY Name NOT IN ('tutorial')", 9, false, "Name", new String(), false); } public void test_CHANGE_TOKEN() { testQuery("SELECT ChangeToken FROM Folder WHERE ChangeToken = 'test'", 0, false, "ObjectId", new String(), false); - testQuery("SELECT ChangeToken FROM Folder WHERE ChangeToken <> 'test'", 33, false, "ObjectId", new String(), false); + testQuery("SELECT ChangeToken FROM Folder WHERE ChangeToken <> 'test'", 10, false, "ObjectId", new String(), false); testQuery("SELECT ChangeToken FROM Folder WHERE ChangeToken < 'test'", 0, false, "ObjectId", new String(), false); testQuery("SELECT ChangeToken FROM Folder WHERE ChangeToken <= 'test'", 0, false, "ObjectId", new String(), false); testQuery("SELECT ChangeToken FROM Folder WHERE ChangeToken > 'test'", 0, false, "ObjectId", new String(), false); testQuery("SELECT ChangeToken FROM Folder WHERE ChangeToken >= 'test'", 0, false, "ObjectId", new String(), false); testQuery("SELECT ChangeToken FROM Folder WHERE ChangeToken IN ('test')", 0, false, "ObjectId", new String(), false); - testQuery("SELECT ChangeToken FROM Folder WHERE ChangeToken NOT IN ('test')", 33, false, "ObjectId", new String(), false); + testQuery("SELECT ChangeToken FROM Folder WHERE ChangeToken NOT IN ('test')", 10, false, "ObjectId", new String(), false); testQuery("SELECT ChangeToken FROM Folder WHERE ChangeToken LIKE 'test'", 0, false, "ObjectId", new String(), false); testQuery("SELECT ChangeToken FROM Folder WHERE ChangeToken NOT LIKE 'test'", 0, false, "ObjectId", new String(), false); testQuery("SELECT ChangeToken FROM Folder WHERE ChangeToken IS NOT NULL", 0, false, "ObjectId", new String(), false); - testQuery("SELECT ChangeToken FROM Folder WHERE ChangeToken IS NULL", 33, false, "ObjectId", new String(), false); + testQuery("SELECT ChangeToken FROM Folder WHERE ChangeToken IS NULL", 10, false, "ObjectId", new String(), false); testQuery("SELECT ChangeToken FROM Folder WHERE 'test' = ANY ChangeToken", 0, false, "ObjectId", new String(), false); - testQuery("SELECT ChangeToken FROM Folder WHERE 'test' <> ANY ChangeToken", 33, false, "ObjectId", new String(), false); + testQuery("SELECT ChangeToken FROM Folder WHERE 'test' <> ANY ChangeToken", 10, false, "ObjectId", new String(), false); testQuery("SELECT ChangeToken FROM Folder WHERE 'test' < ANY ChangeToken", 0, false, "ObjectId", new String(), false); testQuery("SELECT ChangeToken FROM Folder WHERE 'test' <= ANY ChangeToken", 0, false, "ObjectId", new String(), false); testQuery("SELECT ChangeToken FROM Folder WHERE 'test' > ANY ChangeToken", 0, false, "ObjectId", new String(), false); testQuery("SELECT ChangeToken FROM Folder WHERE 'test' >= ANY ChangeToken", 0, false, "ObjectId", new String(), false); testQuery("SELECT ChangeToken FROM Folder WHERE ANY ChangeToken IN ('test')", 0, false, "ObjectId", new String(), false); - testQuery("SELECT ChangeToken FROM Folder WHERE ANY ChangeToken NOT IN ('test')", 33, false, "ObjectId", new String(), false); + testQuery("SELECT ChangeToken FROM Folder WHERE ANY ChangeToken NOT IN ('test')", 10, false, "ObjectId", new String(), false); } public void test_LAST_MODIFICATION_DATE() @@ -711,6 +948,12 @@ public class QueryTest extends BaseCMISTest // By default we are only working to the day Calendar today = Calendar.getInstance(); + + if ((today.get(Calendar.HOUR_OF_DAY) == 0) || (today.get(Calendar.HOUR_OF_DAY) == 23)) + { + return; + } + SimpleDateFormat df = CachingDateFormat.getDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", true); Date date = testQuery("SELECT LastModificationDate FROM Document", -1, false, "LastModificationDate", new Date(), false); @@ -727,30 +970,30 @@ public class QueryTest extends BaseCMISTest // Today (assuming al ws created today) - testQuery("SELECT LastModificationDate FROM Document WHERE LastModificationDate = '" + sDate + "'", 45, false, "ObjectId", new String(), false); + testQuery("SELECT LastModificationDate FROM Document WHERE LastModificationDate = '" + sDate + "'", 10, false, "ObjectId", new String(), false); testQuery("SELECT LastModificationDate FROM Document WHERE LastModificationDate <> '" + sDate + "'", 0, false, "ObjectId", new String(), false); testQuery("SELECT LastModificationDate FROM Document WHERE LastModificationDate < '" + sDate + "'", 0, false, "ObjectId", new String(), false); - testQuery("SELECT LastModificationDate FROM Document WHERE LastModificationDate <= '" + sDate + "'", 45, false, "ObjectId", new String(), false); + testQuery("SELECT LastModificationDate FROM Document WHERE LastModificationDate <= '" + sDate + "'", 10, false, "ObjectId", new String(), false); testQuery("SELECT LastModificationDate FROM Document WHERE LastModificationDate > '" + sDate + "'", 0, false, "ObjectId", new String(), false); - testQuery("SELECT LastModificationDate FROM Document WHERE LastModificationDate >= '" + sDate + "'", 45, false, "ObjectId", new String(), false); + testQuery("SELECT LastModificationDate FROM Document WHERE LastModificationDate >= '" + sDate + "'", 10, false, "ObjectId", new String(), false); - testQuery("SELECT LastModificationDate FROM Document WHERE LastModificationDate IN ('" + sDate + "')", 45, false, "ObjectId", new String(), false); + testQuery("SELECT LastModificationDate FROM Document WHERE LastModificationDate IN ('" + sDate + "')", 10, false, "ObjectId", new String(), false); testQuery("SELECT LastModificationDate FROM Document WHERE LastModificationDate NOT IN ('" + sDate + "')", 0, false, "ObjectId", new String(), false); - testQuery("SELECT LastModificationDate FROM Document WHERE LastModificationDate LIKE '" + sDate + "'", 45, false, "ObjectId", new String(), false); + testQuery("SELECT LastModificationDate FROM Document WHERE LastModificationDate LIKE '" + sDate + "'", 10, false, "ObjectId", new String(), false); testQuery("SELECT LastModificationDate FROM Document WHERE LastModificationDate NOT LIKE '" + sDate + "'", 0, false, "ObjectId", new String(), false); - testQuery("SELECT LastModificationDate FROM Document WHERE LastModificationDate IS NOT NULL", 45, false, "ObjectId", new String(), false); + testQuery("SELECT LastModificationDate FROM Document WHERE LastModificationDate IS NOT NULL", 10, false, "ObjectId", new String(), false); testQuery("SELECT LastModificationDate FROM Document WHERE LastModificationDate IS NULL", 0, false, "ObjectId", new String(), false); - testQuery("SELECT LastModificationDate FROM Document WHERE '" + sDate + "' = ANY LastModificationDate", 45, false, "ObjectId", new String(), false); + testQuery("SELECT LastModificationDate FROM Document WHERE '" + sDate + "' = ANY LastModificationDate", 10, false, "ObjectId", new String(), false); testQuery("SELECT LastModificationDate FROM Document WHERE '" + sDate + "' <> ANY LastModificationDate", 0, false, "ObjectId", new String(), false); testQuery("SELECT LastModificationDate FROM Document WHERE '" + sDate + "' < ANY LastModificationDate", 0, false, "ObjectId", new String(), false); - testQuery("SELECT LastModificationDate FROM Document WHERE '" + sDate + "' <= ANY LastModificationDate", 45, false, "ObjectId", new String(), false); + testQuery("SELECT LastModificationDate FROM Document WHERE '" + sDate + "' <= ANY LastModificationDate", 10, false, "ObjectId", new String(), false); testQuery("SELECT LastModificationDate FROM Document WHERE '" + sDate + "' > ANY LastModificationDate", 0, false, "ObjectId", new String(), false); - testQuery("SELECT LastModificationDate FROM Document WHERE '" + sDate + "' >= ANY LastModificationDate", 45, false, "ObjectId", new String(), false); + testQuery("SELECT LastModificationDate FROM Document WHERE '" + sDate + "' >= ANY LastModificationDate", 10, false, "ObjectId", new String(), false); - testQuery("SELECT LastModificationDate FROM Document WHERE ANY LastModificationDate IN ('" + sDate + "')", 45, false, "ObjectId", new String(), false); + testQuery("SELECT LastModificationDate FROM Document WHERE ANY LastModificationDate IN ('" + sDate + "')", 10, false, "ObjectId", new String(), false); testQuery("SELECT LastModificationDate FROM Document WHERE ANY LastModificationDate NOT IN ('" + sDate + "')", 0, false, "ObjectId", new String(), false); // using yesterday @@ -762,30 +1005,30 @@ public class QueryTest extends BaseCMISTest sDate = df.format(yesterday.getTime()); testQuery("SELECT LastModificationDate FROM Document WHERE LastModificationDate = '" + sDate + "'", 0, false, "ObjectId", new String(), false); - testQuery("SELECT LastModificationDate FROM Document WHERE LastModificationDate <> '" + sDate + "'", 45, false, "ObjectId", new String(), false); + testQuery("SELECT LastModificationDate FROM Document WHERE LastModificationDate <> '" + sDate + "'", 10, false, "ObjectId", new String(), false); testQuery("SELECT LastModificationDate FROM Document WHERE LastModificationDate < '" + sDate + "'", 0, false, "ObjectId", new String(), false); testQuery("SELECT LastModificationDate FROM Document WHERE LastModificationDate <= '" + sDate + "'", 0, false, "ObjectId", new String(), false); - testQuery("SELECT LastModificationDate FROM Document WHERE LastModificationDate > '" + sDate + "'", 45, false, "ObjectId", new String(), false); - testQuery("SELECT LastModificationDate FROM Document WHERE LastModificationDate >= '" + sDate + "'", 45, false, "ObjectId", new String(), false); + testQuery("SELECT LastModificationDate FROM Document WHERE LastModificationDate > '" + sDate + "'", 10, false, "ObjectId", new String(), false); + testQuery("SELECT LastModificationDate FROM Document WHERE LastModificationDate >= '" + sDate + "'", 10, false, "ObjectId", new String(), false); testQuery("SELECT LastModificationDate FROM Document WHERE LastModificationDate IN ('" + sDate + "')", 0, false, "ObjectId", new String(), false); - testQuery("SELECT LastModificationDate FROM Document WHERE LastModificationDate NOT IN ('" + sDate + "')", 45, false, "ObjectId", new String(), false); + testQuery("SELECT LastModificationDate FROM Document WHERE LastModificationDate NOT IN ('" + sDate + "')", 10, false, "ObjectId", new String(), false); testQuery("SELECT LastModificationDate FROM Document WHERE LastModificationDate LIKE '" + sDate + "'", 0, false, "ObjectId", new String(), false); - testQuery("SELECT LastModificationDate FROM Document WHERE LastModificationDate NOT LIKE '" + sDate + "'", 45, false, "ObjectId", new String(), false); + testQuery("SELECT LastModificationDate FROM Document WHERE LastModificationDate NOT LIKE '" + sDate + "'", 10, false, "ObjectId", new String(), false); - testQuery("SELECT LastModificationDate FROM Document WHERE LastModificationDate IS NOT NULL", 45, false, "ObjectId", new String(), false); + testQuery("SELECT LastModificationDate FROM Document WHERE LastModificationDate IS NOT NULL", 10, false, "ObjectId", new String(), false); testQuery("SELECT LastModificationDate FROM Document WHERE LastModificationDate IS NULL", 0, false, "ObjectId", new String(), false); testQuery("SELECT LastModificationDate FROM Document WHERE '" + sDate + "' = ANY LastModificationDate", 0, false, "ObjectId", new String(), false); - testQuery("SELECT LastModificationDate FROM Document WHERE '" + sDate + "' <> ANY LastModificationDate", 45, false, "ObjectId", new String(), false); + testQuery("SELECT LastModificationDate FROM Document WHERE '" + sDate + "' <> ANY LastModificationDate", 10, false, "ObjectId", new String(), false); testQuery("SELECT LastModificationDate FROM Document WHERE '" + sDate + "' < ANY LastModificationDate", 0, false, "ObjectId", new String(), false); testQuery("SELECT LastModificationDate FROM Document WHERE '" + sDate + "' <= ANY LastModificationDate", 0, false, "ObjectId", new String(), false); - testQuery("SELECT LastModificationDate FROM Document WHERE '" + sDate + "' > ANY LastModificationDate", 45, false, "ObjectId", new String(), false); - testQuery("SELECT LastModificationDate FROM Document WHERE '" + sDate + "' >= ANY LastModificationDate", 45, false, "ObjectId", new String(), false); + testQuery("SELECT LastModificationDate FROM Document WHERE '" + sDate + "' > ANY LastModificationDate", 10, false, "ObjectId", new String(), false); + testQuery("SELECT LastModificationDate FROM Document WHERE '" + sDate + "' >= ANY LastModificationDate", 10, false, "ObjectId", new String(), false); testQuery("SELECT LastModificationDate FROM Document WHERE ANY LastModificationDate IN ('" + sDate + "')", 0, false, "ObjectId", new String(), false); - testQuery("SELECT LastModificationDate FROM Document WHERE ANY LastModificationDate NOT IN ('" + sDate + "')", 45, false, "ObjectId", new String(), false); + testQuery("SELECT LastModificationDate FROM Document WHERE ANY LastModificationDate NOT IN ('" + sDate + "')", 10, false, "ObjectId", new String(), false); // using tomorrow @@ -796,59 +1039,59 @@ public class QueryTest extends BaseCMISTest sDate = df.format(tomorrow.getTime()); testQuery("SELECT LastModificationDate FROM Document WHERE LastModificationDate = '" + sDate + "'", 0, false, "ObjectId", new String(), false); - testQuery("SELECT LastModificationDate FROM Document WHERE LastModificationDate <> '" + sDate + "'", 45, false, "ObjectId", new String(), false); - testQuery("SELECT LastModificationDate FROM Document WHERE LastModificationDate < '" + sDate + "'", 45, false, "ObjectId", new String(), false); - testQuery("SELECT LastModificationDate FROM Document WHERE LastModificationDate <= '" + sDate + "'", 45, false, "ObjectId", new String(), false); + testQuery("SELECT LastModificationDate FROM Document WHERE LastModificationDate <> '" + sDate + "'", 10, false, "ObjectId", new String(), false); + testQuery("SELECT LastModificationDate FROM Document WHERE LastModificationDate < '" + sDate + "'", 10, false, "ObjectId", new String(), false); + testQuery("SELECT LastModificationDate FROM Document WHERE LastModificationDate <= '" + sDate + "'", 10, false, "ObjectId", new String(), false); testQuery("SELECT LastModificationDate FROM Document WHERE LastModificationDate > '" + sDate + "'", 0, false, "ObjectId", new String(), false); testQuery("SELECT LastModificationDate FROM Document WHERE LastModificationDate >= '" + sDate + "'", 0, false, "ObjectId", new String(), false); testQuery("SELECT LastModificationDate FROM Document WHERE LastModificationDate IN ('" + sDate + "')", 0, false, "ObjectId", new String(), false); - testQuery("SELECT LastModificationDate FROM Document WHERE LastModificationDate NOT IN ('" + sDate + "')", 45, false, "ObjectId", new String(), false); + testQuery("SELECT LastModificationDate FROM Document WHERE LastModificationDate NOT IN ('" + sDate + "')", 10, false, "ObjectId", new String(), false); testQuery("SELECT LastModificationDate FROM Document WHERE LastModificationDate LIKE '" + sDate + "'", 0, false, "ObjectId", new String(), false); - testQuery("SELECT LastModificationDate FROM Document WHERE LastModificationDate NOT LIKE '" + sDate + "'", 45, false, "ObjectId", new String(), false); + testQuery("SELECT LastModificationDate FROM Document WHERE LastModificationDate NOT LIKE '" + sDate + "'", 10, false, "ObjectId", new String(), false); - testQuery("SELECT LastModificationDate FROM Document WHERE LastModificationDate IS NOT NULL", 45, false, "ObjectId", new String(), false); + testQuery("SELECT LastModificationDate FROM Document WHERE LastModificationDate IS NOT NULL", 10, false, "ObjectId", new String(), false); testQuery("SELECT LastModificationDate FROM Document WHERE LastModificationDate IS NULL", 0, false, "ObjectId", new String(), false); testQuery("SELECT LastModificationDate FROM Document WHERE '" + sDate + "' = ANY LastModificationDate", 0, false, "ObjectId", new String(), false); - testQuery("SELECT LastModificationDate FROM Document WHERE '" + sDate + "' <> ANY LastModificationDate", 45, false, "ObjectId", new String(), false); - testQuery("SELECT LastModificationDate FROM Document WHERE '" + sDate + "' < ANY LastModificationDate", 45, false, "ObjectId", new String(), false); - testQuery("SELECT LastModificationDate FROM Document WHERE '" + sDate + "' <= ANY LastModificationDate", 45, false, "ObjectId", new String(), false); + testQuery("SELECT LastModificationDate FROM Document WHERE '" + sDate + "' <> ANY LastModificationDate", 10, false, "ObjectId", new String(), false); + testQuery("SELECT LastModificationDate FROM Document WHERE '" + sDate + "' < ANY LastModificationDate", 10, false, "ObjectId", new String(), false); + testQuery("SELECT LastModificationDate FROM Document WHERE '" + sDate + "' <= ANY LastModificationDate", 10, false, "ObjectId", new String(), false); testQuery("SELECT LastModificationDate FROM Document WHERE '" + sDate + "' > ANY LastModificationDate", 0, false, "ObjectId", new String(), false); testQuery("SELECT LastModificationDate FROM Document WHERE '" + sDate + "' >= ANY LastModificationDate", 0, false, "ObjectId", new String(), false); testQuery("SELECT LastModificationDate FROM Document WHERE ANY LastModificationDate IN ('" + sDate + "')", 0, false, "ObjectId", new String(), false); - testQuery("SELECT LastModificationDate FROM Document WHERE ANY LastModificationDate NOT IN ('" + sDate + "')", 45, false, "ObjectId", new String(), false); + testQuery("SELECT LastModificationDate FROM Document WHERE ANY LastModificationDate NOT IN ('" + sDate + "')", 10, false, "ObjectId", new String(), false); } public void test_LAST_MODIFIED_BY() { - testQuery("SELECT LastModifiedBy FROM Document WHERE LastModifiedBy = 'System'", 45, false, "ObjectId", new String(), false); + testQuery("SELECT LastModifiedBy FROM Document WHERE LastModifiedBy = 'System'", 10, false, "ObjectId", new String(), false); testQuery("SELECT LastModifiedBy FROM Document WHERE LastModifiedBy <> 'System'", 0, false, "ObjectId", new String(), false); testQuery("SELECT LastModifiedBy FROM Document WHERE LastModifiedBy < 'System'", 0, false, "ObjectId", new String(), false); - testQuery("SELECT LastModifiedBy FROM Document WHERE LastModifiedBy <= 'System'", 45, false, "ObjectId", new String(), false); + testQuery("SELECT LastModifiedBy FROM Document WHERE LastModifiedBy <= 'System'", 10, false, "ObjectId", new String(), false); testQuery("SELECT LastModifiedBy FROM Document WHERE LastModifiedBy > 'System'", 0, false, "ObjectId", new String(), false); - testQuery("SELECT LastModifiedBy FROM Document WHERE LastModifiedBy >= 'System'", 45, false, "ObjectId", new String(), false); + testQuery("SELECT LastModifiedBy FROM Document WHERE LastModifiedBy >= 'System'", 10, false, "ObjectId", new String(), false); - testQuery("SELECT LastModifiedBy FROM Document WHERE LastModifiedBy IN ('System')", 45, false, "ObjectId", new String(), false); + testQuery("SELECT LastModifiedBy FROM Document WHERE LastModifiedBy IN ('System')", 10, false, "ObjectId", new String(), false); testQuery("SELECT LastModifiedBy FROM Document WHERE LastModifiedBy NOT IN ('System')", 0, false, "ObjectId", new String(), false); - testQuery("SELECT LastModifiedBy FROM Document WHERE LastModifiedBy LIKE 'System'", 45, false, "ObjectId", new String(), false); + testQuery("SELECT LastModifiedBy FROM Document WHERE LastModifiedBy LIKE 'System'", 10, false, "ObjectId", new String(), false); testQuery("SELECT LastModifiedBy FROM Document WHERE LastModifiedBy NOT LIKE 'System'", 0, false, "ObjectId", new String(), false); - testQuery("SELECT LastModifiedBy FROM Document WHERE LastModifiedBy IS NOT NULL", 45, false, "ObjectId", new String(), false); + testQuery("SELECT LastModifiedBy FROM Document WHERE LastModifiedBy IS NOT NULL", 10, false, "ObjectId", new String(), false); testQuery("SELECT LastModifiedBy FROM Document WHERE LastModifiedBy IS NULL", 0, false, "ObjectId", new String(), false); - testQuery("SELECT LastModifiedBy FROM Document WHERE 'System' = ANY LastModifiedBy", 45, false, "ObjectId", new String(), false); + testQuery("SELECT LastModifiedBy FROM Document WHERE 'System' = ANY LastModifiedBy", 10, false, "ObjectId", new String(), false); testQuery("SELECT LastModifiedBy FROM Document WHERE 'System' <> ANY LastModifiedBy", 0, false, "ObjectId", new String(), false); testQuery("SELECT LastModifiedBy FROM Document WHERE 'System' < ANY LastModifiedBy", 0, false, "ObjectId", new String(), false); - testQuery("SELECT LastModifiedBy FROM Document WHERE 'System' <= ANY LastModifiedBy", 45, false, "ObjectId", new String(), false); + testQuery("SELECT LastModifiedBy FROM Document WHERE 'System' <= ANY LastModifiedBy", 10, false, "ObjectId", new String(), false); testQuery("SELECT LastModifiedBy FROM Document WHERE 'System' > ANY LastModifiedBy", 0, false, "ObjectId", new String(), false); - testQuery("SELECT LastModifiedBy FROM Document WHERE 'System' >= ANY LastModifiedBy", 45, false, "ObjectId", new String(), false); + testQuery("SELECT LastModifiedBy FROM Document WHERE 'System' >= ANY LastModifiedBy", 10, false, "ObjectId", new String(), false); - testQuery("SELECT LastModifiedBy FROM Document WHERE ANY LastModifiedBy IN ('System')", 45, false, "ObjectId", new String(), false); + testQuery("SELECT LastModifiedBy FROM Document WHERE ANY LastModifiedBy IN ('System')", 10, false, "ObjectId", new String(), false); testQuery("SELECT LastModifiedBy FROM Document WHERE ANY LastModifiedBy NOT IN ('System')", 0, false, "ObjectId", new String(), false); } @@ -858,6 +1101,12 @@ public class QueryTest extends BaseCMISTest // By default we are only working to the day Calendar today = Calendar.getInstance(); + + if ((today.get(Calendar.HOUR_OF_DAY) == 0) || (today.get(Calendar.HOUR_OF_DAY) == 23)) + { + return; + } + SimpleDateFormat df = CachingDateFormat.getDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", true); Date date = testQuery("SELECT CreationDate FROM Document", -1, false, "CreationDate", new Date(), false); @@ -874,30 +1123,30 @@ public class QueryTest extends BaseCMISTest // Today (assuming al ws created today) - testQuery("SELECT CreationDate FROM Document WHERE CreationDate = '" + sDate + "'", 45, false, "ObjectId", new String(), false); + testQuery("SELECT CreationDate FROM Document WHERE CreationDate = '" + sDate + "'", 10, false, "ObjectId", new String(), false); testQuery("SELECT CreationDate FROM Document WHERE CreationDate <> '" + sDate + "'", 0, false, "ObjectId", new String(), false); testQuery("SELECT CreationDate FROM Document WHERE CreationDate < '" + sDate + "'", 0, false, "ObjectId", new String(), false); - testQuery("SELECT CreationDate FROM Document WHERE CreationDate <= '" + sDate + "'", 45, false, "ObjectId", new String(), false); + testQuery("SELECT CreationDate FROM Document WHERE CreationDate <= '" + sDate + "'", 10, false, "ObjectId", new String(), false); testQuery("SELECT CreationDate FROM Document WHERE CreationDate > '" + sDate + "'", 0, false, "ObjectId", new String(), false); - testQuery("SELECT CreationDate FROM Document WHERE CreationDate >= '" + sDate + "'", 45, false, "ObjectId", new String(), false); + testQuery("SELECT CreationDate FROM Document WHERE CreationDate >= '" + sDate + "'", 10, false, "ObjectId", new String(), false); - testQuery("SELECT CreationDate FROM Document WHERE CreationDate IN ('" + sDate + "')", 45, false, "ObjectId", new String(), false); + testQuery("SELECT CreationDate FROM Document WHERE CreationDate IN ('" + sDate + "')", 10, false, "ObjectId", new String(), false); testQuery("SELECT CreationDate FROM Document WHERE CreationDate NOT IN ('" + sDate + "')", 0, false, "ObjectId", new String(), false); - testQuery("SELECT CreationDate FROM Document WHERE CreationDate LIKE '" + sDate + "'", 45, false, "ObjectId", new String(), false); + testQuery("SELECT CreationDate FROM Document WHERE CreationDate LIKE '" + sDate + "'", 10, false, "ObjectId", new String(), false); testQuery("SELECT CreationDate FROM Document WHERE CreationDate NOT LIKE '" + sDate + "'", 0, false, "ObjectId", new String(), false); - testQuery("SELECT CreationDate FROM Document WHERE CreationDate IS NOT NULL", 45, false, "ObjectId", new String(), false); + testQuery("SELECT CreationDate FROM Document WHERE CreationDate IS NOT NULL", 10, false, "ObjectId", new String(), false); testQuery("SELECT CreationDate FROM Document WHERE CreationDate IS NULL", 0, false, "ObjectId", new String(), false); - testQuery("SELECT CreationDate FROM Document WHERE '" + sDate + "' = ANY CreationDate", 45, false, "ObjectId", new String(), false); + testQuery("SELECT CreationDate FROM Document WHERE '" + sDate + "' = ANY CreationDate", 10, false, "ObjectId", new String(), false); testQuery("SELECT CreationDate FROM Document WHERE '" + sDate + "' <> ANY CreationDate", 0, false, "ObjectId", new String(), false); testQuery("SELECT CreationDate FROM Document WHERE '" + sDate + "' < ANY CreationDate", 0, false, "ObjectId", new String(), false); - testQuery("SELECT CreationDate FROM Document WHERE '" + sDate + "' <= ANY CreationDate", 45, false, "ObjectId", new String(), false); + testQuery("SELECT CreationDate FROM Document WHERE '" + sDate + "' <= ANY CreationDate", 10, false, "ObjectId", new String(), false); testQuery("SELECT CreationDate FROM Document WHERE '" + sDate + "' > ANY CreationDate", 0, false, "ObjectId", new String(), false); - testQuery("SELECT CreationDate FROM Document WHERE '" + sDate + "' >= ANY CreationDate", 45, false, "ObjectId", new String(), false); + testQuery("SELECT CreationDate FROM Document WHERE '" + sDate + "' >= ANY CreationDate", 10, false, "ObjectId", new String(), false); - testQuery("SELECT CreationDate FROM Document WHERE ANY CreationDate IN ('" + sDate + "')", 45, false, "ObjectId", new String(), false); + testQuery("SELECT CreationDate FROM Document WHERE ANY CreationDate IN ('" + sDate + "')", 10, false, "ObjectId", new String(), false); testQuery("SELECT CreationDate FROM Document WHERE ANY CreationDate NOT IN ('" + sDate + "')", 0, false, "ObjectId", new String(), false); // using yesterday @@ -909,30 +1158,30 @@ public class QueryTest extends BaseCMISTest sDate = df.format(yesterday.getTime()); testQuery("SELECT CreationDate FROM Document WHERE CreationDate = '" + sDate + "'", 0, false, "ObjectId", new String(), false); - testQuery("SELECT CreationDate FROM Document WHERE CreationDate <> '" + sDate + "'", 45, false, "ObjectId", new String(), false); + testQuery("SELECT CreationDate FROM Document WHERE CreationDate <> '" + sDate + "'", 10, false, "ObjectId", new String(), false); testQuery("SELECT CreationDate FROM Document WHERE CreationDate < '" + sDate + "'", 0, false, "ObjectId", new String(), false); testQuery("SELECT CreationDate FROM Document WHERE CreationDate <= '" + sDate + "'", 0, false, "ObjectId", new String(), false); - testQuery("SELECT CreationDate FROM Document WHERE CreationDate > '" + sDate + "'", 45, false, "ObjectId", new String(), false); - testQuery("SELECT CreationDate FROM Document WHERE CreationDate >= '" + sDate + "'", 45, false, "ObjectId", new String(), false); + testQuery("SELECT CreationDate FROM Document WHERE CreationDate > '" + sDate + "'", 10, false, "ObjectId", new String(), false); + testQuery("SELECT CreationDate FROM Document WHERE CreationDate >= '" + sDate + "'", 10, false, "ObjectId", new String(), false); testQuery("SELECT CreationDate FROM Document WHERE CreationDate IN ('" + sDate + "')", 0, false, "ObjectId", new String(), false); - testQuery("SELECT CreationDate FROM Document WHERE CreationDate NOT IN ('" + sDate + "')", 45, false, "ObjectId", new String(), false); + testQuery("SELECT CreationDate FROM Document WHERE CreationDate NOT IN ('" + sDate + "')", 10, false, "ObjectId", new String(), false); testQuery("SELECT CreationDate FROM Document WHERE CreationDate LIKE '" + sDate + "'", 0, false, "ObjectId", new String(), false); - testQuery("SELECT CreationDate FROM Document WHERE CreationDate NOT LIKE '" + sDate + "'", 45, false, "ObjectId", new String(), false); + testQuery("SELECT CreationDate FROM Document WHERE CreationDate NOT LIKE '" + sDate + "'", 10, false, "ObjectId", new String(), false); - testQuery("SELECT CreationDate FROM Document WHERE CreationDate IS NOT NULL", 45, false, "ObjectId", new String(), false); + testQuery("SELECT CreationDate FROM Document WHERE CreationDate IS NOT NULL", 10, false, "ObjectId", new String(), false); testQuery("SELECT CreationDate FROM Document WHERE CreationDate IS NULL", 0, false, "ObjectId", new String(), false); testQuery("SELECT CreationDate FROM Document WHERE '" + sDate + "' = ANY CreationDate", 0, false, "ObjectId", new String(), false); - testQuery("SELECT CreationDate FROM Document WHERE '" + sDate + "' <> ANY CreationDate", 45, false, "ObjectId", new String(), false); + testQuery("SELECT CreationDate FROM Document WHERE '" + sDate + "' <> ANY CreationDate", 10, false, "ObjectId", new String(), false); testQuery("SELECT CreationDate FROM Document WHERE '" + sDate + "' < ANY CreationDate", 0, false, "ObjectId", new String(), false); testQuery("SELECT CreationDate FROM Document WHERE '" + sDate + "' <= ANY CreationDate", 0, false, "ObjectId", new String(), false); - testQuery("SELECT CreationDate FROM Document WHERE '" + sDate + "' > ANY CreationDate", 45, false, "ObjectId", new String(), false); - testQuery("SELECT CreationDate FROM Document WHERE '" + sDate + "' >= ANY CreationDate", 45, false, "ObjectId", new String(), false); + testQuery("SELECT CreationDate FROM Document WHERE '" + sDate + "' > ANY CreationDate", 10, false, "ObjectId", new String(), false); + testQuery("SELECT CreationDate FROM Document WHERE '" + sDate + "' >= ANY CreationDate", 10, false, "ObjectId", new String(), false); testQuery("SELECT CreationDate FROM Document WHERE ANY CreationDate IN ('" + sDate + "')", 0, false, "ObjectId", new String(), false); - testQuery("SELECT CreationDate FROM Document WHERE ANY CreationDate NOT IN ('" + sDate + "')", 45, false, "ObjectId", new String(), false); + testQuery("SELECT CreationDate FROM Document WHERE ANY CreationDate NOT IN ('" + sDate + "')", 10, false, "ObjectId", new String(), false); // using tomorrow @@ -943,58 +1192,58 @@ public class QueryTest extends BaseCMISTest sDate = df.format(tomorrow.getTime()); testQuery("SELECT CreationDate FROM Document WHERE CreationDate = '" + sDate + "'", 0, false, "ObjectId", new String(), false); - testQuery("SELECT CreationDate FROM Document WHERE CreationDate <> '" + sDate + "'", 45, false, "ObjectId", new String(), false); - testQuery("SELECT CreationDate FROM Document WHERE CreationDate < '" + sDate + "'", 45, false, "ObjectId", new String(), false); - testQuery("SELECT CreationDate FROM Document WHERE CreationDate <= '" + sDate + "'", 45, false, "ObjectId", new String(), false); + testQuery("SELECT CreationDate FROM Document WHERE CreationDate <> '" + sDate + "'", 10, false, "ObjectId", new String(), false); + testQuery("SELECT CreationDate FROM Document WHERE CreationDate < '" + sDate + "'", 10, false, "ObjectId", new String(), false); + testQuery("SELECT CreationDate FROM Document WHERE CreationDate <= '" + sDate + "'", 10, false, "ObjectId", new String(), false); testQuery("SELECT CreationDate FROM Document WHERE CreationDate > '" + sDate + "'", 0, false, "ObjectId", new String(), false); testQuery("SELECT CreationDate FROM Document WHERE CreationDate >= '" + sDate + "'", 0, false, "ObjectId", new String(), false); testQuery("SELECT CreationDate FROM Document WHERE CreationDate IN ('" + sDate + "')", 0, false, "ObjectId", new String(), false); - testQuery("SELECT CreationDate FROM Document WHERE CreationDate NOT IN ('" + sDate + "')", 45, false, "ObjectId", new String(), false); + testQuery("SELECT CreationDate FROM Document WHERE CreationDate NOT IN ('" + sDate + "')", 10, false, "ObjectId", new String(), false); testQuery("SELECT CreationDate FROM Document WHERE CreationDate LIKE '" + sDate + "'", 0, false, "ObjectId", new String(), false); - testQuery("SELECT CreationDate FROM Document WHERE CreationDate NOT LIKE '" + sDate + "'", 45, false, "ObjectId", new String(), false); - testQuery("SELECT CreationDate FROM Document WHERE CreationDate IS NOT NULL", 45, false, "ObjectId", new String(), false); + testQuery("SELECT CreationDate FROM Document WHERE CreationDate NOT LIKE '" + sDate + "'", 10, false, "ObjectId", new String(), false); + testQuery("SELECT CreationDate FROM Document WHERE CreationDate IS NOT NULL", 10, false, "ObjectId", new String(), false); testQuery("SELECT CreationDate FROM Document WHERE CreationDate IS NULL", 0, false, "ObjectId", new String(), false); testQuery("SELECT CreationDate FROM Document WHERE '" + sDate + "' = ANY CreationDate", 0, false, "ObjectId", new String(), false); - testQuery("SELECT CreationDate FROM Document WHERE '" + sDate + "' <> ANY CreationDate", 45, false, "ObjectId", new String(), false); - testQuery("SELECT CreationDate FROM Document WHERE '" + sDate + "' < ANY CreationDate", 45, false, "ObjectId", new String(), false); - testQuery("SELECT CreationDate FROM Document WHERE '" + sDate + "' <= ANY CreationDate", 45, false, "ObjectId", new String(), false); + testQuery("SELECT CreationDate FROM Document WHERE '" + sDate + "' <> ANY CreationDate", 10, false, "ObjectId", new String(), false); + testQuery("SELECT CreationDate FROM Document WHERE '" + sDate + "' < ANY CreationDate", 10, false, "ObjectId", new String(), false); + testQuery("SELECT CreationDate FROM Document WHERE '" + sDate + "' <= ANY CreationDate", 10, false, "ObjectId", new String(), false); testQuery("SELECT CreationDate FROM Document WHERE '" + sDate + "' > ANY CreationDate", 0, false, "ObjectId", new String(), false); testQuery("SELECT CreationDate FROM Document WHERE '" + sDate + "' >= ANY CreationDate", 0, false, "ObjectId", new String(), false); testQuery("SELECT CreationDate FROM Document WHERE ANY CreationDate IN ('" + sDate + "')", 0, false, "ObjectId", new String(), false); - testQuery("SELECT CreationDate FROM Document WHERE ANY CreationDate NOT IN ('" + sDate + "')", 45, false, "ObjectId", new String(), false); + testQuery("SELECT CreationDate FROM Document WHERE ANY CreationDate NOT IN ('" + sDate + "')", 10, false, "ObjectId", new String(), false); } public void test_CREATED_BY() { - testQuery("SELECT CreatedBy FROM Document WHERE CreatedBy = 'System'", 45, false, "ObjectId", new String(), false); + testQuery("SELECT CreatedBy FROM Document WHERE CreatedBy = 'System'", 10, false, "ObjectId", new String(), false); testQuery("SELECT CreatedBy FROM Document WHERE CreatedBy <> 'System'", 0, false, "ObjectId", new String(), false); testQuery("SELECT CreatedBy FROM Document WHERE CreatedBy < 'System'", 0, false, "ObjectId", new String(), false); - testQuery("SELECT CreatedBy FROM Document WHERE CreatedBy <= 'System'", 45, false, "ObjectId", new String(), false); + testQuery("SELECT CreatedBy FROM Document WHERE CreatedBy <= 'System'", 10, false, "ObjectId", new String(), false); testQuery("SELECT CreatedBy FROM Document WHERE CreatedBy > 'System'", 0, false, "ObjectId", new String(), false); - testQuery("SELECT CreatedBy FROM Document WHERE CreatedBy >= 'System'", 45, false, "ObjectId", new String(), false); + testQuery("SELECT CreatedBy FROM Document WHERE CreatedBy >= 'System'", 10, false, "ObjectId", new String(), false); - testQuery("SELECT CreatedBy FROM Document WHERE CreatedBy IN ('System')", 45, false, "ObjectId", new String(), false); + testQuery("SELECT CreatedBy FROM Document WHERE CreatedBy IN ('System')", 10, false, "ObjectId", new String(), false); testQuery("SELECT CreatedBy FROM Document WHERE CreatedBy NOT IN ('System')", 0, false, "ObjectId", new String(), false); - testQuery("SELECT CreatedBy FROM Document WHERE CreatedBy LIKE 'System'", 45, false, "ObjectId", new String(), false); + testQuery("SELECT CreatedBy FROM Document WHERE CreatedBy LIKE 'System'", 10, false, "ObjectId", new String(), false); testQuery("SELECT CreatedBy FROM Document WHERE CreatedBy NOT LIKE 'System'", 0, false, "ObjectId", new String(), false); - testQuery("SELECT CreatedBy FROM Document WHERE CreatedBy IS NOT NULL", 45, false, "ObjectId", new String(), false); + testQuery("SELECT CreatedBy FROM Document WHERE CreatedBy IS NOT NULL", 10, false, "ObjectId", new String(), false); testQuery("SELECT CreatedBy FROM Document WHERE CreatedBy IS NULL", 0, false, "ObjectId", new String(), false); - testQuery("SELECT CreatedBy FROM Document WHERE 'System' = ANY CreatedBy", 45, false, "ObjectId", new String(), false); + testQuery("SELECT CreatedBy FROM Document WHERE 'System' = ANY CreatedBy", 10, false, "ObjectId", new String(), false); testQuery("SELECT CreatedBy FROM Document WHERE 'System' <> ANY CreatedBy", 0, false, "ObjectId", new String(), false); testQuery("SELECT CreatedBy FROM Document WHERE 'System' < ANY CreatedBy", 0, false, "ObjectId", new String(), false); - testQuery("SELECT CreatedBy FROM Document WHERE 'System' <= ANY CreatedBy", 45, false, "ObjectId", new String(), false); + testQuery("SELECT CreatedBy FROM Document WHERE 'System' <= ANY CreatedBy", 10, false, "ObjectId", new String(), false); testQuery("SELECT CreatedBy FROM Document WHERE 'System' > ANY CreatedBy", 0, false, "ObjectId", new String(), false); - testQuery("SELECT CreatedBy FROM Document WHERE 'System' >= ANY CreatedBy", 45, false, "ObjectId", new String(), false); + testQuery("SELECT CreatedBy FROM Document WHERE 'System' >= ANY CreatedBy", 10, false, "ObjectId", new String(), false); - testQuery("SELECT CreatedBy FROM Document WHERE ANY CreatedBy IN ('System')", 45, false, "ObjectId", new String(), false); + testQuery("SELECT CreatedBy FROM Document WHERE ANY CreatedBy IN ('System')", 10, false, "ObjectId", new String(), false); testQuery("SELECT CreatedBy FROM Document WHERE ANY CreatedBy NOT IN ('System')", 0, false, "ObjectId", new String(), false); } @@ -1003,58 +1252,58 @@ public class QueryTest extends BaseCMISTest { // DOC - testQuery("SELECT ObjectTypeId FROM Document WHERE ObjectTypeId = 'Document'", 45, false, "ObjectId", new String(), false); + testQuery("SELECT ObjectTypeId FROM Document WHERE ObjectTypeId = 'Document'", 10, false, "ObjectId", new String(), false); testQuery("SELECT ObjectTypeId FROM Document WHERE ObjectTypeId <> 'Document'", 0, false, "ObjectId", new String(), false); testQuery("SELECT ObjectTypeId FROM Document WHERE ObjectTypeId < 'Document'", 0, false, "ObjectId", new String(), true); testQuery("SELECT ObjectTypeId FROM Document WHERE ObjectTypeId <= 'Document'", 0, false, "ObjectId", new String(), true); testQuery("SELECT ObjectTypeId FROM Document WHERE ObjectTypeId > 'Document'", 0, false, "ObjectId", new String(), true); testQuery("SELECT ObjectTypeId FROM Document WHERE ObjectTypeId >= 'Document'", 0, false, "ObjectId", new String(), true); - testQuery("SELECT ObjectTypeId FROM Document WHERE ObjectTypeId IN ('Document')", 45, false, "ObjectId", new String(), false); + testQuery("SELECT ObjectTypeId FROM Document WHERE ObjectTypeId IN ('Document')", 10, false, "ObjectId", new String(), false); testQuery("SELECT ObjectTypeId FROM Document WHERE ObjectTypeId NOT IN ('Document')", 0, false, "ObjectId", new String(), false); - testQuery("SELECT ObjectTypeId FROM Document WHERE ObjectTypeId LIKE 'Document'", 45, false, "ObjectId", new String(), false); + testQuery("SELECT ObjectTypeId FROM Document WHERE ObjectTypeId LIKE 'Document'", 10, false, "ObjectId", new String(), false); testQuery("SELECT ObjectTypeId FROM Document WHERE ObjectTypeId NOT LIKE 'Document'", 0, false, "ObjectId", new String(), false); - testQuery("SELECT ObjectTypeId FROM Document WHERE ObjectTypeId IS NOT NULL", 45, false, "ObjectId", new String(), false); + testQuery("SELECT ObjectTypeId FROM Document WHERE ObjectTypeId IS NOT NULL", 10, false, "ObjectId", new String(), false); testQuery("SELECT ObjectTypeId FROM Document WHERE ObjectTypeId IS NULL", 0, false, "ObjectId", new String(), false); - testQuery("SELECT ObjectTypeId FROM Document WHERE 'Document' = ANY ObjectTypeId", 45, false, "ObjectId", new String(), false); + testQuery("SELECT ObjectTypeId FROM Document WHERE 'Document' = ANY ObjectTypeId", 10, false, "ObjectId", new String(), false); testQuery("SELECT ObjectTypeId FROM Document WHERE 'Document' <> ANY ObjectTypeId", 0, false, "ObjectId", new String(), false); testQuery("SELECT ObjectTypeId FROM Document WHERE 'Document' < ANY ObjectTypeId", 0, false, "ObjectId", new String(), true); testQuery("SELECT ObjectTypeId FROM Document WHERE 'Document' <= ANY ObjectTypeId", 0, false, "ObjectId", new String(), true); testQuery("SELECT ObjectTypeId FROM Document WHERE 'Document' > ANY ObjectTypeId", 0, false, "ObjectId", new String(), true); testQuery("SELECT ObjectTypeId FROM Document WHERE 'Document' >= ANY ObjectTypeId", 0, false, "ObjectId", new String(), true); - testQuery("SELECT ObjectTypeId FROM Document WHERE ANY ObjectTypeId IN ('Document')", 45, false, "ObjectId", new String(), false); + testQuery("SELECT ObjectTypeId FROM Document WHERE ANY ObjectTypeId IN ('Document')", 10, false, "ObjectId", new String(), false); testQuery("SELECT ObjectTypeId FROM Document WHERE ANY ObjectTypeId NOT IN ('Document')", 0, false, "ObjectId", new String(), false); // FOLDER - testQuery("SELECT ObjectTypeId FROM Folder WHERE ObjectTypeId = 'Folder'", 33, false, "ObjectId", new String(), false); + testQuery("SELECT ObjectTypeId FROM Folder WHERE ObjectTypeId = 'Folder'", 10, false, "ObjectId", new String(), false); testQuery("SELECT ObjectTypeId FROM Folder WHERE ObjectTypeId <> 'Folder'", 0, false, "ObjectId", new String(), false); testQuery("SELECT ObjectTypeId FROM Folder WHERE ObjectTypeId < 'Folder'", 0, false, "ObjectId", new String(), true); testQuery("SELECT ObjectTypeId FROM Folder WHERE ObjectTypeId <= 'Folder'", 0, false, "ObjectId", new String(), true); testQuery("SELECT ObjectTypeId FROM Folder WHERE ObjectTypeId > 'Folder'", 0, false, "ObjectId", new String(), true); testQuery("SELECT ObjectTypeId FROM Folder WHERE ObjectTypeId >= 'Folder'", 0, false, "ObjectId", new String(), true); - testQuery("SELECT ObjectTypeId FROM Folder WHERE ObjectTypeId IN ('Folder')", 33, false, "ObjectId", new String(), false); + testQuery("SELECT ObjectTypeId FROM Folder WHERE ObjectTypeId IN ('Folder')", 10, false, "ObjectId", new String(), false); testQuery("SELECT ObjectTypeId FROM Folder WHERE ObjectTypeId NOT IN ('Folder')", 0, false, "ObjectId", new String(), false); - testQuery("SELECT ObjectTypeId FROM Folder WHERE ObjectTypeId LIKE 'Folder'", 33, false, "ObjectId", new String(), false); + testQuery("SELECT ObjectTypeId FROM Folder WHERE ObjectTypeId LIKE 'Folder'", 10, false, "ObjectId", new String(), false); testQuery("SELECT ObjectTypeId FROM Folder WHERE ObjectTypeId NOT LIKE 'Folder'", 0, false, "ObjectId", new String(), false); - testQuery("SELECT ObjectTypeId FROM Folder WHERE ObjectTypeId IS NOT NULL", 33, false, "ObjectId", new String(), false); + testQuery("SELECT ObjectTypeId FROM Folder WHERE ObjectTypeId IS NOT NULL", 10, false, "ObjectId", new String(), false); testQuery("SELECT ObjectTypeId FROM Folder WHERE ObjectTypeId IS NULL", 0, false, "ObjectId", new String(), false); - testQuery("SELECT ObjectTypeId FROM Folder WHERE 'Folder' = ANY ObjectTypeId", 33, false, "ObjectId", new String(), false); + testQuery("SELECT ObjectTypeId FROM Folder WHERE 'Folder' = ANY ObjectTypeId", 10, false, "ObjectId", new String(), false); testQuery("SELECT ObjectTypeId FROM Folder WHERE 'Folder' <> ANY ObjectTypeId", 0, false, "ObjectId", new String(), false); testQuery("SELECT ObjectTypeId FROM Folder WHERE 'Folder' < ANY ObjectTypeId", 0, false, "ObjectId", new String(), true); testQuery("SELECT ObjectTypeId FROM Folder WHERE 'Folder' <= ANY ObjectTypeId", 0, false, "ObjectId", new String(), true); testQuery("SELECT ObjectTypeId FROM Folder WHERE 'Folder' > ANY ObjectTypeId", 0, false, "ObjectId", new String(), true); testQuery("SELECT ObjectTypeId FROM Folder WHERE 'Folder' >= ANY ObjectTypeId", 0, false, "ObjectId", new String(), true); - testQuery("SELECT ObjectTypeId FROM Folder WHERE ANY ObjectTypeId IN ('Folder')", 33, false, "ObjectId", new String(), false); + testQuery("SELECT ObjectTypeId FROM Folder WHERE ANY ObjectTypeId IN ('Folder')", 10, false, "ObjectId", new String(), false); testQuery("SELECT ObjectTypeId FROM Folder WHERE ANY ObjectTypeId NOT IN ('Folder')", 0, false, "ObjectId", new String(), false); // RELATIONSHIP @@ -1066,69 +1315,73 @@ public class QueryTest extends BaseCMISTest public void test_URI() { testQuery("SELECT Uri FROM Folder WHERE Uri = 'test'", 0, false, "ObjectId", new String(), false); - testQuery("SELECT Uri FROM Folder WHERE Uri <> 'test'", 33, false, "ObjectId", new String(), false); + testQuery("SELECT Uri FROM Folder WHERE Uri <> 'test'", 10, false, "ObjectId", new String(), false); testQuery("SELECT Uri FROM Folder WHERE Uri < 'test'", 0, false, "ObjectId", new String(), false); testQuery("SELECT Uri FROM Folder WHERE Uri <= 'test'", 0, false, "ObjectId", new String(), false); testQuery("SELECT Uri FROM Folder WHERE Uri > 'test'", 0, false, "ObjectId", new String(), false); testQuery("SELECT Uri FROM Folder WHERE Uri >= 'test'", 0, false, "ObjectId", new String(), false); testQuery("SELECT Uri FROM Folder WHERE Uri IN ('test')", 0, false, "ObjectId", new String(), false); - testQuery("SELECT Uri FROM Folder WHERE Uri NOT IN ('test')", 33, false, "ObjectId", new String(), false); + testQuery("SELECT Uri FROM Folder WHERE Uri NOT IN ('test')", 10, false, "ObjectId", new String(), false); testQuery("SELECT Uri FROM Folder WHERE Uri LIKE 'test'", 0, false, "ObjectId", new String(), false); testQuery("SELECT Uri FROM Folder WHERE Uri NOT LIKE 'test'", 0, false, "ObjectId", new String(), false); testQuery("SELECT Uri FROM Folder WHERE Uri IS NOT NULL", 0, false, "ObjectId", new String(), false); - testQuery("SELECT Uri FROM Folder WHERE Uri IS NULL", 33, false, "ObjectId", new String(), false); + testQuery("SELECT Uri FROM Folder WHERE Uri IS NULL", 10, false, "ObjectId", new String(), false); testQuery("SELECT Uri FROM Folder WHERE 'test' = ANY Uri", 0, false, "ObjectId", new String(), false); - testQuery("SELECT Uri FROM Folder WHERE 'test' <> ANY Uri", 33, false, "ObjectId", new String(), false); + testQuery("SELECT Uri FROM Folder WHERE 'test' <> ANY Uri", 10, false, "ObjectId", new String(), false); testQuery("SELECT Uri FROM Folder WHERE 'test' < ANY Uri", 0, false, "ObjectId", new String(), false); testQuery("SELECT Uri FROM Folder WHERE 'test' <= ANY Uri", 0, false, "ObjectId", new String(), false); testQuery("SELECT Uri FROM Folder WHERE 'test' > ANY Uri", 0, false, "ObjectId", new String(), false); testQuery("SELECT Uri FROM Folder WHERE 'test' >= ANY Uri", 0, false, "ObjectId", new String(), false); testQuery("SELECT Uri FROM Folder WHERE ANY Uri IN ('test')", 0, false, "ObjectId", new String(), false); - testQuery("SELECT Uri FROM Folder WHERE ANY Uri NOT IN ('test')", 33, false, "ObjectId", new String(), false); + testQuery("SELECT Uri FROM Folder WHERE ANY Uri NOT IN ('test')", 10, false, "ObjectId", new String(), false); } public void test_ObjectId() { - String companyHomeId = testQuery("SELECT ObjectId FROM Folder WHERE Name = '\"company home\"'", 1, false, "ObjectId", new String(), false); + String companyHomeId = testQuery("SELECT ObjectId FROM Folder WHERE Name = '\"Folder 0\"'", 1, false, "ObjectId", new String(), false); + + Serializable ser = cmisPropertyService.getProperty(f0, CMISMapping.PROP_OBJECT_ID); + String id = DefaultTypeConverter.INSTANCE.convert(String.class, ser); + + assertEquals(companyHomeId, id); testQuery("SELECT ObjectId FROM Folder WHERE ObjectId = '" + companyHomeId + "'", 1, false, "ObjectId", new String(), false); - testQuery("SELECT ObjectId FROM Folder WHERE ObjectId <> '" + companyHomeId + "'", 32, false, "ObjectId", new String(), false); + testQuery("SELECT ObjectId FROM Folder WHERE ObjectId <> '" + companyHomeId + "'", 9, false, "ObjectId", new String(), false); testQuery("SELECT ObjectId FROM Folder WHERE ObjectId < '" + companyHomeId + "'", 0, false, "ObjectId", new String(), true); testQuery("SELECT ObjectId FROM Folder WHERE ObjectId <= '" + companyHomeId + "'", 0, false, "ObjectId", new String(), true); testQuery("SELECT ObjectId FROM Folder WHERE ObjectId > '" + companyHomeId + "'", 0, false, "ObjectId", new String(), true); testQuery("SELECT ObjectId FROM Folder WHERE ObjectId >= '" + companyHomeId + "'", 0, false, "ObjectId", new String(), true); testQuery("SELECT ObjectId FROM Folder WHERE ObjectId IN ('" + companyHomeId + "')", 1, false, "ObjectId", new String(), false); - testQuery("SELECT ObjectId FROM Folder WHERE ObjectId NOT IN ('" + companyHomeId + "')", 32, false, "ObjectId", new String(), false); + testQuery("SELECT ObjectId FROM Folder WHERE ObjectId NOT IN ('" + companyHomeId + "')", 9, false, "ObjectId", new String(), false); testQuery("SELECT ObjectId FROM Folder WHERE ObjectId LIKE '" + companyHomeId + "'", 1, false, "ObjectId", new String(), false); - testQuery("SELECT ObjectId FROM Folder WHERE ObjectId NOT LIKE '" + companyHomeId + "'", 32, false, "ObjectId", new String(), false); + testQuery("SELECT ObjectId FROM Folder WHERE ObjectId NOT LIKE '" + companyHomeId + "'", 9, false, "ObjectId", new String(), false); - testQuery("SELECT ObjectId FROM Folder WHERE IN_FOLDER('" + companyHomeId + "')", 4, false, "ObjectId", new String(), false); - testQuery("SELECT ObjectId FROM Folder WHERE IN_TREE ('" + companyHomeId + "')", 32, false, "ObjectId", new String(), false); + testQuery("SELECT ObjectId FROM Folder WHERE IN_FOLDER('" + companyHomeId + "')", 2, false, "ObjectId", new String(), false); + testQuery("SELECT ObjectId FROM Folder WHERE IN_TREE ('" + companyHomeId + "')", 6, false, "ObjectId", new String(), false); - testQuery("SELECT ObjectId FROM Folder WHERE ObjectId IS NOT NULL", 33, false, "ObjectId", new String(), false); + testQuery("SELECT ObjectId FROM Folder WHERE ObjectId IS NOT NULL", 10, false, "ObjectId", new String(), false); testQuery("SELECT ObjectId FROM Folder WHERE ObjectId IS NULL", 0, false, "ObjectId", new String(), false); testQuery("SELECT ObjectId FROM Folder WHERE '" + companyHomeId + "' = ANY ObjectId", 1, false, "ObjectId", new String(), false); - testQuery("SELECT ObjectId FROM Folder WHERE '" + companyHomeId + "' <> ANY ObjectId", 32, false, "ObjectId", new String(), false); + testQuery("SELECT ObjectId FROM Folder WHERE '" + companyHomeId + "' <> ANY ObjectId", 9, false, "ObjectId", new String(), false); testQuery("SELECT ObjectId FROM Folder WHERE '" + companyHomeId + "' < ANY ObjectId", 0, false, "ObjectId", new String(), true); testQuery("SELECT ObjectId FROM Folder WHERE '" + companyHomeId + "' <= ANY ObjectId", 0, false, "ObjectId", new String(), true); testQuery("SELECT ObjectId FROM Folder WHERE '" + companyHomeId + "' > ANY ObjectId", 0, false, "ObjectId", new String(), true); testQuery("SELECT ObjectId FROM Folder WHERE '" + companyHomeId + "' >= ANY ObjectId", 0, false, "ObjectId", new String(), true); testQuery("SELECT ObjectId FROM Folder WHERE ANY ObjectId IN ('" + companyHomeId + "')", 1, false, "ObjectId", new String(), false); - testQuery("SELECT ObjectId FROM Folder WHERE ANY ObjectId NOT IN ('" + companyHomeId + "')", 32, false, "ObjectId", new String(), false); + testQuery("SELECT ObjectId FROM Folder WHERE ANY ObjectId NOT IN ('" + companyHomeId + "')", 9, false, "ObjectId", new String(), false); } public void testOrderBy() { - String query = "SELECT ObjectId FROM Document ORDER ObjectId"; CMISResultSet rs = cmisQueryService.query(query); // assertEquals(1, rs.getLength()); @@ -1183,287 +1436,45 @@ public class QueryTest extends BaseCMISTest public void testAllSimpleTextPredicates() { - String query = "SELECT * FROM Folder WHERE Name IS NOT NULL AND Name = 'company'"; - CMISResultSet rs = cmisQueryService.query(query); - assertEquals(1, rs.getLength()); - for (CMISResultSetRow row : rs) - { - System.out.println(row.getValue("Name") + " Score " + row.getScore() + " " + row.getScores()); - } - rs.close(); - rs = null; - - query = "SELECT * FROM Folder WHERE Name IS NOT NULL AND NOT Name = 'company'"; - rs = cmisQueryService.query(query); - assertEquals(32, rs.getLength()); - for (CMISResultSetRow row : rs) - { - System.out.println(row.getValue("Name") + " Score " + row.getScore() + " " + row.getScores()); - } - rs.close(); - rs = null; - - query = "SELECT * FROM Folder WHERE Name IS NOT NULL AND 'company' = ANY Name"; - rs = cmisQueryService.query(query); - assertEquals(1, rs.getLength()); - for (CMISResultSetRow row : rs) - { - System.out.println(row.getValue("Name") + " Score " + row.getScore() + " " + row.getScores()); - } - rs.close(); - rs = null; - - query = "SELECT * FROM Folder WHERE Name IS NOT NULL AND NOT Name <> 'company'"; - rs = cmisQueryService.query(query); - assertEquals(1, rs.getLength()); - for (CMISResultSetRow row : rs) - { - System.out.println(row.getValue("Name") + " Score " + row.getScore() + " " + row.getScores()); - } - rs.close(); - rs = null; - - query = "SELECT * FROM Folder WHERE Name IS NOT NULL AND Name <> 'company'"; - rs = cmisQueryService.query(query); - assertEquals(32, rs.getLength()); - for (CMISResultSetRow row : rs) - { - System.out.println(row.getValue("Name") + " Score " + row.getScore() + " " + row.getScores()); - } - rs.close(); - rs = null; - - query = "SELECT * FROM Folder WHERE Name IS NOT NULL AND Name < 'company'"; - rs = cmisQueryService.query(query); - assertEquals(6, rs.getLength()); - for (CMISResultSetRow row : rs) - { - System.out.println(row.getValue("Name") + " Score " + row.getScore() + " " + row.getScores()); - } - rs.close(); - rs = null; - - query = "SELECT * FROM Folder WHERE Name IS NOT NULL AND Name <= 'company'"; - rs = cmisQueryService.query(query); - assertEquals(7, rs.getLength()); - for (CMISResultSetRow row : rs) - { - System.out.println(row.getValue("Name") + " Score " + row.getScore() + " " + row.getScores()); - } - rs.close(); - rs = null; - - query = "SELECT * FROM Folder WHERE Name IS NOT NULL AND Name > 'company'"; - rs = cmisQueryService.query(query); - assertEquals(30, rs.getLength()); - for (CMISResultSetRow row : rs) - { - System.out.println(row.getValue("Name") + " Score " + row.getScore() + " " + row.getScores()); - } - rs.close(); - rs = null; - - query = "SELECT * FROM Folder WHERE Name IS NOT NULL AND Name >= 'company'"; - rs = cmisQueryService.query(query); - assertEquals(30, rs.getLength()); - for (CMISResultSetRow row : rs) - { - System.out.println(row.getValue("Name") + " Score " + row.getScore() + " " + row.getScores()); - } - rs.close(); - rs = null; - - query = "SELECT * FROM Folder WHERE Name IS NOT NULL AND Name IN ('company', 'home')"; - rs = cmisQueryService.query(query); - assertEquals(2, rs.getLength()); - for (CMISResultSetRow row : rs) - { - System.out.println(row.getValue("Name") + " Score " + row.getScore() + " " + row.getScores()); - } - rs.close(); - rs = null; - - query = "SELECT * FROM Folder WHERE Name IS NOT NULL AND Name NOT IN ('company', 'home')"; - rs = cmisQueryService.query(query); - assertEquals(31, rs.getLength()); - for (CMISResultSetRow row : rs) - { - System.out.println(row.getValue("Name") + " Score " + row.getScore() + " " + row.getScores()); - } - rs.close(); - rs = null; - - query = "SELECT * FROM Folder WHERE Name IS NOT NULL AND ANY Name IN ('company', 'home')"; - rs = cmisQueryService.query(query); - assertEquals(2, rs.getLength()); - for (CMISResultSetRow row : rs) - { - System.out.println(row.getValue("Name") + " Score " + row.getScore() + " " + row.getScores()); - } - rs.close(); - rs = null; - - query = "SELECT * FROM Folder WHERE Name IS NOT NULL AND ANY Name NOT IN ('company', 'home')"; - rs = cmisQueryService.query(query); - assertEquals(31, rs.getLength()); - for (CMISResultSetRow row : rs) - { - System.out.println(row.getValue("Name") + " Score " + row.getScore() + " " + row.getScores()); - } - rs.close(); - rs = null; - - query = "SELECT * FROM Folder WHERE Name IS NOT NULL AND Name LIKE 'company'"; - rs = cmisQueryService.query(query); - assertEquals(1, rs.getLength()); - for (CMISResultSetRow row : rs) - { - System.out.println(row.getValue("Name") + " Score " + row.getScore() + " " + row.getScores()); - } - rs.close(); - rs = null; - - query = "SELECT * FROM Folder WHERE Name IS NOT NULL AND Name LIKE 'com%'"; - rs = cmisQueryService.query(query); - assertEquals(1, rs.getLength()); - for (CMISResultSetRow row : rs) - { - System.out.println(row.getValue("Name") + " Score " + row.getScore() + " " + row.getScores()); - } - rs.close(); - rs = null; - - query = "SELECT * FROM Folder WHERE Name IS NOT NULL AND Name LIKE 'c_m_a_y'"; - rs = cmisQueryService.query(query); - assertEquals(1, rs.getLength()); - for (CMISResultSetRow row : rs) - { - System.out.println(row.getValue("Name") + " Score " + row.getScore() + " " + row.getScores()); - } - rs.close(); - rs = null; - - query = "SELECT * FROM Folder WHERE Name IS NOT NULL AND Name NOT LIKE 'c_m_a_y'"; - rs = cmisQueryService.query(query); - assertEquals(32, rs.getLength()); - for (CMISResultSetRow row : rs) - { - System.out.println(row.getValue("Name") + " Score " + row.getScore() + " " + row.getScores()); - } - rs.close(); - rs = null; + testQuery("SELECT * FROM Folder WHERE Name IS NOT NULL AND Name = 'Folder 1'", 1, false, "ObjectId", new String(), false); + testQuery("SELECT * FROM Folder WHERE Name IS NOT NULL AND NOT Name = 'Folder 1'", 9, false, "ObjectId", new String(), false); + testQuery("SELECT * FROM Folder WHERE Name IS NOT NULL AND 'Folder 1' = ANY Name", 1, false, "ObjectId", new String(), false); + testQuery("SELECT * FROM Folder WHERE Name IS NOT NULL AND NOT Name <> 'Folder 1'", 1, false, "ObjectId", new String(), false); + testQuery("SELECT * FROM Folder WHERE Name IS NOT NULL AND Name <> 'Folder 1'", 9, false, "ObjectId", new String(), false); + testQuery("SELECT * FROM Folder WHERE Name IS NOT NULL AND Name < 'Folder 1'", 10, false, "ObjectId", new String(), false); + testQuery("SELECT * FROM Folder WHERE Name IS NOT NULL AND Name <= 'Folder 1'", 10, false, "ObjectId", new String(), false); + testQuery("SELECT * FROM Folder WHERE Name IS NOT NULL AND Name > 'Folder 1'", 0, false, "ObjectId", new String(), false); + testQuery("SELECT * FROM Folder WHERE Name IS NOT NULL AND Name >= 'Folder 1'", 0, false, "ObjectId", new String(), false); + testQuery("SELECT * FROM Folder WHERE Name IS NOT NULL AND Name IN ('Folder', '1')", 10, false, "ObjectId", new String(), false); + testQuery("SELECT * FROM Folder WHERE Name IS NOT NULL AND Name NOT IN ('Folder', '1')", 0, false, "ObjectId", new String(), false); + testQuery("SELECT * FROM Folder WHERE Name IS NOT NULL AND ANY Name IN ('Folder', '1')", 10, false, "ObjectId", new String(), false); + testQuery("SELECT * FROM Folder WHERE Name IS NOT NULL AND ANY Name NOT IN ('2', '3')", 8, false, "ObjectId", new String(), false); + testQuery("SELECT * FROM Folder WHERE Name IS NOT NULL AND Name LIKE 'Folder 1'", 1, false, "ObjectId", new String(), false); + testQuery("SELECT * FROM Folder WHERE Name IS NOT NULL AND Name LIKE 'Fol%'", 10, false, "ObjectId", new String(), false); + testQuery("SELECT * FROM Folder WHERE Name IS NOT NULL AND Name LIKE 'F_l_e_'", 10, false, "ObjectId", new String(), false); + testQuery("SELECT * FROM Folder WHERE Name IS NOT NULL AND Name NOT LIKE 'F_l_e_'", 0, false, "ObjectId", new String(), false); } public void testSimpleConjunction() { - - String query = "SELECT * FROM Folder WHERE Name IS NOT NULL AND Name = 'company'"; - CMISResultSet rs = cmisQueryService.query(query); - assertEquals(1, rs.getLength()); - for (CMISResultSetRow row : rs) - { - System.out.println(row.getValue("Name") + " Score " + row.getScore() + " " + row.getScores()); - } - rs.close(); - rs = null; - - query = "SELECT * FROM Folder WHERE Name IS NOT NULL AND Name = 'home'"; - rs = cmisQueryService.query(query); - assertEquals(2, rs.getLength()); - for (CMISResultSetRow row : rs) - { - System.out.println(row.getValue("Name") + " Score " + row.getScore() + " " + row.getScores()); - } - rs.close(); - rs = null; - - query = "SELECT * FROM Folder WHERE Name IS NOT NULL AND Name = 'home' AND Name = 'company'"; - rs = cmisQueryService.query(query); - assertEquals(1, rs.getLength()); - for (CMISResultSetRow row : rs) - { - System.out.println(row.getValue("Name") + " Score " + row.getScore() + " " + row.getScores()); - } - rs.close(); - rs = null; + testQuery("SELECT * FROM Folder WHERE Name IS NOT NULL AND Name = 'Folder 1'", 1, false, "ObjectId", new String(), false); + testQuery("SELECT * FROM Folder WHERE Name IS NOT NULL AND Name = 'Folder'", 10, false, "ObjectId", new String(), false); + testQuery("SELECT * FROM Folder WHERE Name IS NOT NULL AND Name = 'Folder' AND Name = '1'", 1, false, "ObjectId", new String(), false); } public void testSimpleDisjunction() { - - String query = "SELECT * FROM Folder WHERE Name = 'guest'"; - CMISResultSet rs = cmisQueryService.query(query); - assertEquals(1, rs.getLength()); - for (CMISResultSetRow row : rs) - { - System.out.println(row.getValue("Name") + " Score " + row.getScore() + " " + row.getScores()); - } - rs.close(); - rs = null; - - query = "SELECT * FROM Folder WHERE Name = 'company'"; - rs = cmisQueryService.query(query); - assertEquals(1, rs.getLength()); - for (CMISResultSetRow row : rs) - { - System.out.println(row.getValue("Name") + " Score " + row.getScore() + " " + row.getScores()); - } - rs.close(); - rs = null; - - query = "SELECT * FROM Folder WHERE Name = 'guest' OR Name = 'company'"; - rs = cmisQueryService.query(query); - assertEquals(2, rs.getLength()); - for (CMISResultSetRow row : rs) - { - System.out.println(row.getValue("Name") + " Score " + row.getScore() + " " + row.getScores()); - } - rs.close(); - rs = null; - + testQuery("SELECT * FROM Folder WHERE Name = 'Folder 1'", 1, false, "ObjectId", new String(), false); + testQuery("SELECT * FROM Folder WHERE Name = 'Folder 2'", 1, false, "ObjectId", new String(), false); + testQuery("SELECT * FROM Folder WHERE Name = 'Folder 1' OR Name = 'Folder 2'", 2, false, "ObjectId", new String(), false); } public void testExists() { - String query = "SELECT * FROM Folder WHERE Name IS NOT NULL"; - CMISResultSet rs = cmisQueryService.query(query); - assertEquals(33, rs.getLength()); - for (CMISResultSetRow row : rs) - { - System.out.println(row.getValue("Name") + " Score " + row.getScore() + " " + row.getScores()); - } - rs.close(); - rs = null; - - query = "SELECT * FROM Folder WHERE Name IS NULL"; - rs = cmisQueryService.query(query); - assertEquals(0, rs.getLength()); - for (CMISResultSetRow row : rs) - { - System.out.println(row.getValue("Name") + " Score " + row.getScore() + " " + row.getScores()); - } - rs.close(); - rs = null; - - query = "SELECT * FROM Document WHERE Uri IS NOT NULL"; - rs = cmisQueryService.query(query); - assertEquals(0, rs.getLength()); - for (CMISResultSetRow row : rs) - { - System.out.println(row.getValue("Name") + " Score " + row.getScore() + " " + row.getScores()); - } - rs.close(); - rs = null; - - query = "SELECT * FROM Document WHERE Uri IS NULL"; - rs = cmisQueryService.query(query); - assertEquals(45, rs.getLength()); - for (CMISResultSetRow row : rs) - { - System.out.println(row.getValue("Name") + " Score " + row.getScore() + " " + row.getScores()); - } - rs.close(); - rs = null; + testQuery("SELECT * FROM Folder WHERE Name IS NOT NULL", 10, false, "ObjectId", new String(), false); + testQuery("SELECT * FROM Folder WHERE Name IS NULL", 0, false, "ObjectId", new String(), false); + testQuery("SELECT * FROM Document WHERE Uri IS NOT NULL", 0, false, "ObjectId", new String(), false); + testQuery("SELECT * FROM Document WHERE Uri IS NULL", 10, false, "ObjectId", new String(), false); } public void testObjectEquals() @@ -1478,124 +1489,53 @@ public class QueryTest extends BaseCMISTest public void testFolderEquals() { - NodeRef rootNode = cmisService.getDefaultRootNodeRef(); - - Serializable ser = cmisPropertyService.getProperty(rootNode, CMISMapping.PROP_NAME); + Serializable ser = cmisPropertyService.getProperty(f0, CMISMapping.PROP_NAME); String Name = DefaultTypeConverter.INSTANCE.convert(String.class, ser); - String query = "SELECT * FROM Folder WHERE Name = '" + Name + "'"; - CMISResultSet rs = cmisQueryService.query(query); - assertEquals(1, rs.getLength()); - for (CMISResultSetRow row : rs) - { - System.out.println(row.getValue("Name") + " Score " + row.getScore() + " " + row.getScores()); - } - rs.close(); - rs = null; - - query = "SELECT * FROM Folder WHERE Name = 'company'"; - rs = cmisQueryService.query(query); - assertEquals(1, rs.getLength()); - for (CMISResultSetRow row : rs) - { - System.out.println(row.getValue("Name") + " Score " + row.getScore() + " " + row.getScores()); - } - rs.close(); - rs = null; - - query = "SELECT * FROM Folder WHERE ParentId = '" + rootNode.toString() + "'"; - rs = cmisQueryService.query(query); - assertEquals(4, rs.getLength()); - for (CMISResultSetRow row : rs) - { - System.out.println(row.getValue("Name") + " Score " + row.getScore() + " " + row.getScores()); - } - rs.close(); - rs = null; - - query = "SELECT * FROM Folder WHERE AllowedChildObjectTypeIds = 'meep'"; - rs = cmisQueryService.query(query); - assertEquals(0, rs.getLength()); - for (CMISResultSetRow row : rs) - { - System.out.println(row.getValue("Name") + " Score " + row.getScore() + " " + row.getScores()); - } - rs.close(); - rs = null; - + testQuery("SELECT * FROM Folder WHERE Name = '" + Name + "'", 1, false, "ObjectId", new String(), false); + testQuery("SELECT * FROM Folder WHERE Name = 'Folder 1'", 1, false, "ObjectId", new String(), false); + testQuery("SELECT * FROM Folder WHERE ParentId = '" + rootNodeRef.toString() + "'", 4, false, "ObjectId", new String(), false); + testQuery("SELECT * FROM Folder WHERE AllowedChildObjectTypeIds = 'meep'", 0, false, "ObjectId", new String(), true); } public void test_IN_TREE() { - NodeRef rootNode = cmisService.getDefaultRootNodeRef(); - - Serializable ser = cmisPropertyService.getProperty(rootNode, CMISMapping.PROP_OBJECT_ID); + Serializable ser = cmisPropertyService.getProperty(f0, CMISMapping.PROP_OBJECT_ID); String id = DefaultTypeConverter.INSTANCE.convert(String.class, ser); - String query = "SELECT * FROM Folder WHERE IN_TREE('" + id + "')"; - CMISResultSet rs = cmisQueryService.query(query); - assertEquals(32, rs.getLength()); - for (CMISResultSetRow row : rs) - { - System.out.println(row.getValue("Name") + " Score " + row.getScore() + " " + row.getScores()); - } - rs.close(); - + testQuery("SELECT * FROM Folder WHERE IN_TREE('" + id + "')", 6, false, "ObjectId", new String(), false); } public void test_IN_FOLDER() { - NodeRef rootNode = cmisService.getDefaultRootNodeRef(); - - Serializable ser = cmisPropertyService.getProperty(rootNode, CMISMapping.PROP_OBJECT_ID); + Serializable ser = cmisPropertyService.getProperty(f0, CMISMapping.PROP_OBJECT_ID); String id = DefaultTypeConverter.INSTANCE.convert(String.class, ser); - String query = "SELECT * FROM Folder WHERE IN_FOLDER('" + id + "')"; - CMISResultSet rs = cmisQueryService.query(query); - assertEquals(4, rs.getLength()); - for (CMISResultSetRow row : rs) - { - System.out.println(row.getValue("Name") + " Score " + row.getScore() + " " + row.getScores()); - } - rs.close(); + testQuery("SELECT * FROM Folder WHERE IN_FOLDER('" + id + "')", 2, false, "ObjectId", new String(), false); } public void testFTS() { - String query = "SELECT * FROM Document WHERE CONTAINS('\"Sample demonstrating the listing of AVM folder contents\"')"; - CMISResultSet rs = cmisQueryService.query(query); - assertEquals(1, rs.getLength()); - for (CMISResultSetRow row : rs) - { - System.out.println(row.getValue("Name") + " Score " + row.getScore() + " " + row.getScores()); - } - rs.close(); + testQuery("SELECT * FROM Document WHERE CONTAINS('\"zebra\"')", 9, false, "ObjectId", new String(), false); + testQuery("SELECT * FROM Document WHERE CONTAINS('\"quick\"')", 1, false, "ObjectId", new String(), false); } public void testBasicSelectAsGuest() { runAs("guest"); - String query = "SELECT * FROM Document"; - CMISResultSet rs = cmisQueryService.query(query); - assertEquals(1, rs.getLength()); - rs.close(); + testQuery("SELECT * FROM Document", 0, false, "ObjectId", new String(), false); + } public void testBasicSelect() { - String query = "SELECT * FROM Document"; - CMISResultSet rs = cmisQueryService.query(query); - for (CMISResultSetRow row : rs) - { - System.out.println("Score " + row.getScore() + " " + row.getScores()); - } - rs.close(); + testQuery("SELECT * FROM Document", 10, false, "ObjectId", new String(), false); } public void testBasicDefaultMetaData() { - String query = "SELECT * FROM Document"; - CMISResultSet rs = cmisQueryService.query(query); + CMISQueryOptions options = new CMISQueryOptions("SELECT * FROM Document", rootNodeRef.getStoreRef()); + CMISResultSet rs = cmisQueryService.query(options); CMISResultSetMetaData md = rs.getMetaData(); assertNotNull(md.getQueryOptions()); assertEquals(cmisDictionaryService.getPropertyDefinitions(CMISMapping.DOCUMENT_TYPE_ID).size(), md.getColumnNames().length); @@ -1607,8 +1547,8 @@ public class QueryTest extends BaseCMISTest public void testBasicMetaData() { - String query = "SELECT DOC.ObjectId, DOC.ObjectId AS ID FROM Document AS DOC"; - CMISResultSet rs = cmisQueryService.query(query); + CMISQueryOptions options = new CMISQueryOptions("SELECT DOC.ObjectId, DOC.ObjectId AS ID FROM Document AS DOC", rootNodeRef.getStoreRef()); + CMISResultSet rs = cmisQueryService.query(options); CMISResultSetMetaData md = rs.getMetaData(); assertNotNull(md.getQueryOptions()); assertEquals(2, md.getColumnNames().length); @@ -1621,8 +1561,8 @@ public class QueryTest extends BaseCMISTest public void testBasicColumns() { - String query = "SELECT DOC.ObjectId, DOC.ObjectTypeId AS ID FROM Folder AS DOC"; - CMISResultSet rs = cmisQueryService.query(query); + CMISQueryOptions options = new CMISQueryOptions("SELECT DOC.ObjectId, DOC.ObjectTypeId AS ID FROM Folder AS DOC", rootNodeRef.getStoreRef()); + CMISResultSet rs = cmisQueryService.query(options); CMISResultSetMetaData md = rs.getMetaData(); assertNotNull(md.getQueryOptions()); assertEquals(2, md.getColumnNames().length); @@ -1639,8 +1579,9 @@ public class QueryTest extends BaseCMISTest public void testBasicAllDocumentColumns() { - String query = "SELECT DOC.* FROM Document AS DOC"; - CMISResultSet rs = cmisQueryService.query(query); + CMISQueryOptions options = new CMISQueryOptions("SELECT DOC.* FROM Document AS DOC", rootNodeRef.getStoreRef()); + CMISResultSet rs = cmisQueryService.query(options); + CMISResultSetMetaData md = rs.getMetaData(); for (CMISResultSetRow row : rs) @@ -1656,8 +1597,9 @@ public class QueryTest extends BaseCMISTest public void testBasicAllFolderColumns() { - String query = "SELECT * FROM Folder AS DOC"; - CMISResultSet rs = cmisQueryService.query(query); + CMISQueryOptions options = new CMISQueryOptions("SELECT * FROM Folder AS DOC", rootNodeRef.getStoreRef()); + CMISResultSet rs = cmisQueryService.query(options); + CMISResultSetMetaData md = rs.getMetaData(); for (CMISResultSetRow row : rs) @@ -1673,8 +1615,9 @@ public class QueryTest extends BaseCMISTest public void testBasicAll_ST_SITES_Columns() { - String query = "SELECT * FROM ST_SITES AS DOC"; - CMISResultSet rs = cmisQueryService.query(query); + CMISQueryOptions options = new CMISQueryOptions("SELECT * FROM ST_SITES AS DOC", rootNodeRef.getStoreRef()); + CMISResultSet rs = cmisQueryService.query(options); + CMISResultSetMetaData md = rs.getMetaData(); for (CMISResultSetRow row : rs) @@ -1693,8 +1636,11 @@ public class QueryTest extends BaseCMISTest public void testFunctionColumns() { - String query = "SELECT DOC.Name AS Name, \nLOWER(\tDOC.Name \n), LOWER ( DOC.Name ) AS LName, UPPER ( DOC.Name ) , UPPER(DOC.Name) AS UName, Score(), SCORE(DOC), SCORE() AS SCORED, SCORE(DOC) AS DOCSCORE FROM Folder AS DOC"; - CMISResultSet rs = cmisQueryService.query(query); + CMISQueryOptions options = new CMISQueryOptions( + "SELECT DOC.Name AS Name, \nLOWER(\tDOC.Name \n), LOWER ( DOC.Name ) AS LName, UPPER ( DOC.Name ) , UPPER(DOC.Name) AS UName, Score(), SCORE(DOC), SCORE() AS SCORED, SCORE(DOC) AS DOCSCORE FROM Folder AS DOC", + rootNodeRef.getStoreRef()); + CMISResultSet rs = cmisQueryService.query(options); + CMISResultSetMetaData md = rs.getMetaData(); assertNotNull(md.getQueryOptions()); assertEquals(9, md.getColumnNames().length); @@ -1718,33 +1664,149 @@ public class QueryTest extends BaseCMISTest rs.close(); } - public void xtestParse1() + public void testParse1() throws RecognitionException { String query = "SELECT UPPER(1.0) AS WOOF FROM Document AS DOC LEFT OUTER JOIN Folder AS FOLDER ON (DOC.Name = FOLDER.Name) WHERE LOWER(DOC.Name = ' woof' AND CONTAINS(, 'one two three') AND CONTAINS(, 'DOC.Name:lemur AND woof') AND (DOC.Name in ('one', 'two') AND IN_FOLDER('meep') AND DOC.Name like 'woof' and DOC.Name = 'woof' and DOC.ObjectId = 'meep') ORDER BY DOC.Name DESC, WOOF"; - cmisQueryService.query(query); + parse(query); } - public void xtestParse2() + public void testParse2() throws RecognitionException { String query = "SELECT TITLE, AUTHORS, DATE FROM WHITE_PAPER WHERE ( IN_TREE( , 'ID00093854763') ) AND ( 'SMITH' = ANY AUTHORS )"; - cmisQueryService.query(query); + parse(query); } - public void xtestParse3() + public void testParse3() throws RecognitionException { String query = "SELECT ObjectId, SCORE() AS X, DESTINATION, DEPARTURE_DATES FROM TRAVEL_BROCHURE WHERE ( CONTAINS(, 'CARIBBEAN CENTRAL AMERICA CRUISE TOUR') ) AND ( '2009-1-1' < ANY DEPARTURE_DATES ) ORDER BY X DESC"; - cmisQueryService.query(query); + parse(query); } - public void xtestParse4() + public void testParse4() throws RecognitionException { String query = "SELECT * FROM CAR_REVIEW WHERE ( LOWER(MAKE) = 'buick' ) OR ( ANY FEATURES IN ('NAVIGATION SYSTEM', 'SATELLITE RADIO', 'MP3' ) )"; - cmisQueryService.query(query); + parse(query); } - public void xtestParse5() + public void testParse5() throws RecognitionException { String query = "SELECT Y.CLAIM_NUM, X.PROPERTY_ADDRESS, Y.DAMAGE_ESTIMATES FROM POLICY AS X JOIN CLAIMS AS Y ON ( X.POLICY_NUM = Y.POLICY_NUM ) WHERE ( 100000 <= ANY Y.DAMAGE_ESTIMATES ) AND ( Y.CAUSE NOT LIKE '%Katrina%' )"; - cmisQueryService.query(query); + parse(query); + } + + public void testParse6() throws RecognitionException + { + String query = "SELECT * FROM CM_TITLED"; + parse(query); + query = "SELECT D.*, T.* FROM DOCUMENT AS D JOIN CM_TITLED AS T ON (D.OBJECTID = T.OBJECTID)"; + parse(query); + query = "SELECT D.*, T.* FROM CM_TITLED T JOIN DOCUMENT D ON (D.OBJECTID = T.OBJECTID)"; + parse(query); + } + + public void testAspectProperties() + { + CMISQueryOptions options = new CMISQueryOptions("SELECT * FROM CM_OWNABLE O", rootNodeRef.getStoreRef()); + options.setQueryMode(CMISQueryMode.CMS_WITH_ALFRESCO_EXTENSIONS); + + CMISResultSet rs = cmisQueryService.query(options); + + CMISResultSetMetaData md = rs.getMetaData(); + assertNotNull(md.getQueryOptions()); + assertEquals(1, md.getColumnNames().length); + assertNotNull(md.getColumn("O.cm_owner")); + assertEquals(1, md.getSelectors().length); + assertNotNull(md.getSelector("O")); + for (CMISResultSetRow row : rs) + { + System.out.println("\n\n"); + System.out.println(row.getValues()); + System.out.println("\n\n"); + } + rs.close(); + } + + public void testAspectJoin() + { + testQuery("SELECT * FROM CM_OWNABLE", 1, false, "ObjectId", new String(), false, CMISQueryMode.CMS_WITH_ALFRESCO_EXTENSIONS); + testQuery("SELECT * FROM CM_OWNABLE where CM_oWNER = 'andy'", 1, false, "ObjectId", new String(), false, CMISQueryMode.CMS_WITH_ALFRESCO_EXTENSIONS); + testQuery("SELECT * FROM CM_OWNABLE where CM_OWNER = 'bob'", 0, false, "ObjectId", new String(), false, CMISQueryMode.CMS_WITH_ALFRESCO_EXTENSIONS); + testQuery("SELECT D.*, O.* FROM DOCUMENT AS D JOIN CM_OWNABLE AS O ON (D.ObjectId = O.ObjectId)", 1, false, "ObjectId", new String(), false, + CMISQueryMode.CMS_WITH_ALFRESCO_EXTENSIONS); + testQuery("SELECT D.*, O.* FROM DOCUMENT AS D JOIN CM_OWNABLE AS O ON (D.OBJECTID = O.OBJECTID)", 1, false, "ObjectId", new String(), false, + CMISQueryMode.CMS_WITH_ALFRESCO_EXTENSIONS); + testQuery("SELECT D.*, O.*, T.* FROM DOCUMENT AS D JOIN CM_OWNABLE AS O ON (D.OBJECTID = O.OBJECTID) JOIN CM_TITLED T ON (T.OBJECTID = D.OBJECTID)", 1, false, "ObjectId", + new String(), false, CMISQueryMode.CMS_WITH_ALFRESCO_EXTENSIONS); + testQuery("SELECT D.*, O.* FROM CM_OWNABLE O JOIN DOCUMENT D ON (D.ObjectId = O.ObjectId)", 1, false, "ObjectId", new String(), false, + CMISQueryMode.CMS_WITH_ALFRESCO_EXTENSIONS); + testQuery("SELECT D.*, F.* FROM FOLDER F JOIN DOCUMENT D ON (D.ObjectId = F.ObjectId)", 0, false, "ObjectId", new String(), false, + CMISQueryMode.CMS_WITH_ALFRESCO_EXTENSIONS); + testQuery("SELECT O.*, T.* FROM CM_OWNABLE O JOIN CM_TITLED T ON (O.ObjectId = T.ObjectId)", 1, false, "ObJeCtId", new String(), false, + CMISQueryMode.CMS_WITH_ALFRESCO_EXTENSIONS); + testQuery("select o.*, t.* from cm_ownable o join cm_titled t on (o.objectid = t.objectid)", 1, false, "objectid", new String(), false, + CMISQueryMode.CMS_WITH_ALFRESCO_EXTENSIONS); + testQuery("sElEcT o.*, T.* fRoM cM_oWnAbLe o JoIn Cm_TiTlEd T oN (o.oBjEcTiD = T.ObJeCtId)", 1, false, "OBJECTID", new String(), false, + CMISQueryMode.CMS_WITH_ALFRESCO_EXTENSIONS); + testQuery("select o.*, t.* from ( cm_ownable o join cm_titled t on (o.objectid = t.objectid) )", 1, false, "objectid", new String(), false, + CMISQueryMode.CMS_WITH_ALFRESCO_EXTENSIONS); + testQuery("select o.*, t.* from ( cm_ownable o join cm_titled t on (o.objectid = t.objectid) JOIN DOCUMENT AS D ON (D.objectid = o.objectid ) )", 1, false, "objectid", + new String(), false, CMISQueryMode.CMS_WITH_ALFRESCO_EXTENSIONS); + testQuery( + "select o.*, t.* from ( cm_ownable o join cm_titled t on (o.objectid = t.objectid) JOIN DOCUMENT AS D ON (D.objectid = o.objectid ) ) where o.cm_owner = 'andy' and t.cm_title = 'Alfresco tutorial' and CONTAINS('jumped') and 2 <> D.ContentStreamLength ", + 1, false, "objectid", new String(), false, CMISQueryMode.CMS_WITH_ALFRESCO_EXTENSIONS); + } + + public void testPaging() + { + + CMISQueryOptions options = new CMISQueryOptions("SELECT * FROM FOLDER", rootNodeRef.getStoreRef()); + List expected = new ArrayList(10); + + CMISResultSet rs = cmisQueryService.query(options); + assertEquals(10, rs.getLength()); + for (CMISResultSetRow row : rs) + { + Serializable sValue = row.getValue("ObjectId"); + String id = DefaultTypeConverter.INSTANCE.convert(String.class, sValue); + expected.add(id); + } + rs.close(); + + for (int skip = 0; skip < 20; skip++) + { + for(int max = 0; max < 20; max++) + { + doPage(expected, skip, max); + } + } + + } + + private void doPage(List expected, int skip, int max) + { + CMISQueryOptions options = new CMISQueryOptions("SELECT * FROM FOLDER", rootNodeRef.getStoreRef()); + options.setSkipCount(skip); + options.setMaxItems(max); + CMISResultSet rs = cmisQueryService.query(options); + assertEquals("Skip = "+skip+ " max = "+max, skip+max > 10 ? 10 - skip : max, rs.getLength()); + assertEquals("Skip = "+skip+ " max = "+max, (skip+max) < 10, rs.hasMore()); + assertEquals("Skip = "+skip+ " max = "+max, skip, rs.getStart()); + int actualPosition = skip; + for (CMISResultSetRow row : rs) + { + Serializable sValue = row.getValue("ObjectId"); + String id = DefaultTypeConverter.INSTANCE.convert(String.class, sValue); + assertEquals("Skip = "+skip+ " max = "+max+" actual = "+actualPosition, expected.get(actualPosition), id); + actualPosition++; + } + } + + private void parse(String query) throws RecognitionException + { + CharStream cs = new ANTLRStringStream(query); + CMISLexer lexer = new CMISLexer(cs); + CommonTokenStream tokens = new CommonTokenStream(lexer); + CMISParser parser = new CMISParser(tokens); + CommonTree queryNode = (CommonTree) parser.query().getTree(); } } diff --git a/source/java/org/alfresco/cmis/search/impl/CMISQueryParser.java b/source/java/org/alfresco/cmis/search/impl/CMISQueryParser.java index e60d77e9b0..ec5279a640 100644 --- a/source/java/org/alfresco/cmis/search/impl/CMISQueryParser.java +++ b/source/java/org/alfresco/cmis/search/impl/CMISQueryParser.java @@ -38,9 +38,11 @@ import org.alfresco.cmis.dictionary.CMISDictionaryService; import org.alfresco.cmis.dictionary.CMISMapping; import org.alfresco.cmis.dictionary.CMISPropertyDefinition; import org.alfresco.cmis.dictionary.CMISScope; +import org.alfresco.cmis.dictionary.CMISTypeDefinition; import org.alfresco.cmis.dictionary.CMISTypeId; import org.alfresco.cmis.search.CMISQueryException; import org.alfresco.cmis.search.CMISQueryOptions; +import org.alfresco.cmis.search.CMISQueryOptions.CMISQueryMode; import org.alfresco.repo.search.impl.parsers.CMISLexer; import org.alfresco.repo.search.impl.parsers.CMISParser; import org.alfresco.repo.search.impl.parsers.FTSLexer; @@ -50,12 +52,18 @@ import org.alfresco.repo.search.impl.querymodel.ArgumentDefinition; import org.alfresco.repo.search.impl.querymodel.Column; import org.alfresco.repo.search.impl.querymodel.Constraint; import org.alfresco.repo.search.impl.querymodel.Function; +import org.alfresco.repo.search.impl.querymodel.FunctionArgument; import org.alfresco.repo.search.impl.querymodel.JoinType; +import org.alfresco.repo.search.impl.querymodel.ListArgument; +import org.alfresco.repo.search.impl.querymodel.LiteralArgument; import org.alfresco.repo.search.impl.querymodel.Order; import org.alfresco.repo.search.impl.querymodel.Ordering; +import org.alfresco.repo.search.impl.querymodel.ParameterArgument; +import org.alfresco.repo.search.impl.querymodel.PropertyArgument; import org.alfresco.repo.search.impl.querymodel.Query; import org.alfresco.repo.search.impl.querymodel.QueryModelFactory; import org.alfresco.repo.search.impl.querymodel.Selector; +import org.alfresco.repo.search.impl.querymodel.SelectorArgument; import org.alfresco.repo.search.impl.querymodel.Source; import org.alfresco.repo.search.impl.querymodel.impl.BaseComparison; import org.alfresco.repo.search.impl.querymodel.impl.functions.Child; @@ -120,13 +128,13 @@ public class CMISQueryParser Source source = buildSource(sourceNode, joinSupport, factory); Map selectors = source.getSelectors(); ArrayList columns = buildColumns(queryNode, factory, selectors, options.getQuery()); - + HashSet columnNames = new HashSet(); - for(Column column : columns) + for (Column column : columns) { - if(!columnNames.add(column.getAlias())) + if (!columnNames.add(column.getAlias())) { - throw new CMISQueryException("Duplicate column alias for "+column.getAlias()); + throw new CMISQueryException("Duplicate column alias for " + column.getAlias()); } } @@ -221,7 +229,7 @@ public class CMISQueryParser { if (notNode.getType() == CMISParser.NEGATION) { - Constraint constraint = buildTest((CommonTree)notNode.getChild(0), factory, selectors, columns); + Constraint constraint = buildTest((CommonTree) notNode.getChild(0), factory, selectors, columns); return factory.createNegation(constraint); } else @@ -275,6 +283,10 @@ public class CMISQueryParser if (predicateNode.getChildCount() > 1) { arg = getFunctionArgument(argNode, function.getArgumentDefinition(Child.ARG_SELECTOR), factory, selectors); + if(!arg.isQueryable()) + { + throw new CMISQueryException("The property is not queryable: "+argNode.getText()); + } functionArguments.put(arg.getName(), arg); } return factory.createFunctionalConstraint(function, functionArguments); @@ -382,7 +394,7 @@ public class CMISQueryParser FTSParser parser = null; try { - CharStream cs = new ANTLRStringStream(ftsExpression.substring(1, ftsExpression.length()-1)); + CharStream cs = new ANTLRStringStream(ftsExpression.substring(1, ftsExpression.length() - 1)); FTSLexer lexer = new FTSLexer(cs); CommonTokenStream tokens = new CommonTokenStream(lexer); parser = new FTSParser(tokens); @@ -466,7 +478,8 @@ public class CMISQueryParser String functionName; Function function; Map functionArguments; - Argument arg; + LiteralArgument larg; + PropertyArgument parg; switch (testNode.getType()) { case FTSParser.DISJUNCTION: @@ -477,24 +490,32 @@ public class CMISQueryParser functionName = FTSTerm.NAME; function = factory.getFunction(functionName); functionArguments = new LinkedHashMap(); - arg = factory.createLiteralArgument(FTSTerm.ARG_TERM, DataTypeDefinition.TEXT, testNode.getChild(0).getText()); - functionArguments.put(arg.getName(), arg); + larg = factory.createLiteralArgument(FTSTerm.ARG_TERM, DataTypeDefinition.TEXT, testNode.getChild(0).getText()); + functionArguments.put(larg.getName(), larg); if (testNode.getChildCount() > 1) { - arg = buildColumnReference(FTSTerm.ARG_PROPERTY, (CommonTree) testNode.getChild(1), factory); - functionArguments.put(arg.getName(), arg); + parg = buildColumnReference(FTSTerm.ARG_PROPERTY, (CommonTree) testNode.getChild(1), factory); + if(!selectors.containsKey(parg.getSelector())) + { + throw new CMISQueryException("No table with alias "+parg.getSelector()); + } + functionArguments.put(parg.getName(), parg); } return factory.createFunctionalConstraint(function, functionArguments); case FTSParser.EXACT_TERM: functionName = FTSExactTerm.NAME; function = factory.getFunction(functionName); functionArguments = new LinkedHashMap(); - arg = factory.createLiteralArgument(FTSExactTerm.ARG_TERM, DataTypeDefinition.TEXT, testNode.getChild(0).getText()); - functionArguments.put(arg.getName(), arg); + larg = factory.createLiteralArgument(FTSExactTerm.ARG_TERM, DataTypeDefinition.TEXT, testNode.getChild(0).getText()); + functionArguments.put(larg.getName(), larg); if (testNode.getChildCount() > 1) { - arg = buildColumnReference(FTSExactTerm.ARG_PROPERTY, (CommonTree) testNode.getChild(1), factory); - functionArguments.put(arg.getName(), arg); + parg = buildColumnReference(FTSExactTerm.ARG_PROPERTY, (CommonTree) testNode.getChild(1), factory); + if(!selectors.containsKey(parg.getSelector())) + { + throw new CMISQueryException("No table with alias "+parg.getSelector()); + } + functionArguments.put(parg.getName(), parg); } return factory.createFunctionalConstraint(function, functionArguments); case FTSParser.PHRASE: @@ -502,12 +523,16 @@ public class CMISQueryParser functionName = FTSPhrase.NAME; function = factory.getFunction(functionName); functionArguments = new LinkedHashMap(); - arg = factory.createLiteralArgument(FTSPhrase.ARG_PHRASE, DataTypeDefinition.TEXT, testNode.getChild(0).getText()); - functionArguments.put(arg.getName(), arg); + larg = factory.createLiteralArgument(FTSPhrase.ARG_PHRASE, DataTypeDefinition.TEXT, testNode.getChild(0).getText()); + functionArguments.put(larg.getName(), larg); if (testNode.getChildCount() > 1) { - arg = buildColumnReference(FTSPhrase.ARG_PROPERTY, (CommonTree) testNode.getChild(1), factory); - functionArguments.put(arg.getName(), arg); + parg = buildColumnReference(FTSPhrase.ARG_PROPERTY, (CommonTree) testNode.getChild(1), factory); + if(!selectors.containsKey(parg.getSelector())) + { + throw new CMISQueryException("No table with alias "+parg.getSelector()); + } + functionArguments.put(parg.getName(), parg); } return factory.createFunctionalConstraint(function, functionArguments); case FTSParser.SYNONYM: @@ -598,7 +623,8 @@ public class CMISQueryParser Function function = factory.getFunction(PropertyAccessor.NAME); QName propertyQName = cmisMapping.getPropertyQName(definition.getPropertyName()); - Argument arg = factory.createPropertyArgument(PropertyAccessor.ARG_PROPERTY, selector.getAlias(), propertyQName); + Argument arg = factory.createPropertyArgument(PropertyAccessor.ARG_PROPERTY, definition.isQueryable(), definition.isOrderable(), selector.getAlias(), + propertyQName); Map functionArguments = new LinkedHashMap(); functionArguments.put(arg.getName(), arg); @@ -606,6 +632,7 @@ public class CMISQueryParser match = factory.createColumn(function, functionArguments, alias); } + orderColumn = match; } else @@ -639,7 +666,8 @@ public class CMISQueryParser Function function = factory.getFunction(PropertyAccessor.NAME); QName propertyQName = cmisMapping.getPropertyQName(definition.getPropertyName()); - Argument arg = factory.createPropertyArgument(PropertyAccessor.ARG_PROPERTY, selector.getAlias(), propertyQName); + Argument arg = factory.createPropertyArgument(PropertyAccessor.ARG_PROPERTY, definition.isQueryable(), definition.isOrderable(), selector.getAlias(), + propertyQName); Map functionArguments = new LinkedHashMap(); functionArguments.put(arg.getName(), arg); @@ -648,7 +676,10 @@ public class CMISQueryParser orderColumn = factory.createColumn(function, functionArguments, alias); } - // TODO: check orderable - add to the column definition + if (!orderColumn.isOrderable()) + { + throw new CMISQueryException("Ordering is not support for " + orderColumn.getAlias()); + } Ordering ordering = factory.createOrdering(orderColumn, order); orderings.add(ordering); @@ -680,7 +711,14 @@ public class CMISQueryParser } else { - throw new CMISQueryException("Type unsupported in CMIS queries: " + selector.getAlias()); + if (options.getQueryMode() == CMISQueryMode.CMS_STRICT) + { + throw new CMISQueryException("Type unsupported in CMIS queries: " + selector.getAlias()); + } + else + { + typeId = cmisMapping.getCmisTypeId(CMISScope.POLICY, cmisType); + } } Map propDefs = cmisDictionaryService.getPropertyDefinitions(typeId); for (CMISPropertyDefinition definition : propDefs.values()) @@ -689,7 +727,8 @@ public class CMISQueryParser { Function function = factory.getFunction(PropertyAccessor.NAME); QName propertyQName = cmisMapping.getPropertyQName(definition.getPropertyName()); - Argument arg = factory.createPropertyArgument(PropertyAccessor.ARG_PROPERTY, selector.getAlias(), propertyQName); + Argument arg = factory.createPropertyArgument(PropertyAccessor.ARG_PROPERTY, definition.isQueryable(), definition.isOrderable(), selector.getAlias(), + propertyQName); Map functionArguments = new LinkedHashMap(); functionArguments.put(arg.getName(), arg); String alias = (selector.getAlias().length() > 0) ? selector.getAlias() + "." + definition.getPropertyName() : definition.getPropertyName(); @@ -703,9 +742,9 @@ public class CMISQueryParser CommonTree columnsNode = (CommonTree) queryNode.getFirstChildWithType(CMISParser.COLUMNS); if (columnsNode != null) { - for (CommonTree columnNode : (List)columnsNode.getChildren()) + for (CommonTree columnNode : (List) columnsNode.getChildren()) { - if(columnNode.getType() == CMISParser.ALL_COLUMNS) + if (columnNode.getType() == CMISParser.ALL_COLUMNS) { String qualifier = columnNode.getChild(0).getText(); Selector selector = selectors.get(qualifier); @@ -725,7 +764,15 @@ public class CMISQueryParser } else { - throw new CMISQueryException("Type unsupported in CMIS queries: " + selector.getAlias()); + if (options.getQueryMode() == CMISQueryMode.CMS_STRICT) + { + throw new CMISQueryException("Type unsupported in CMIS queries: " + selector.getAlias()); + } + else + { + typeId = cmisMapping.getCmisTypeId(CMISScope.POLICY, cmisType); + } + } Map propDefs = cmisDictionaryService.getPropertyDefinitions(typeId); for (CMISPropertyDefinition definition : propDefs.values()) @@ -734,7 +781,8 @@ public class CMISQueryParser { Function function = factory.getFunction(PropertyAccessor.NAME); QName propertyQName = cmisMapping.getPropertyQName(definition.getPropertyName()); - Argument arg = factory.createPropertyArgument(PropertyAccessor.ARG_PROPERTY, selector.getAlias(), propertyQName); + Argument arg = factory.createPropertyArgument(PropertyAccessor.ARG_PROPERTY, definition.isQueryable(), definition.isOrderable(), selector.getAlias(), + propertyQName); Map functionArguments = new LinkedHashMap(); functionArguments.put(arg.getName(), arg); String alias = (selector.getAlias().length() > 0) ? selector.getAlias() + "." + definition.getPropertyName() : definition.getPropertyName(); @@ -744,7 +792,7 @@ public class CMISQueryParser } } - if(columnNode.getType() == CMISParser.COLUMN) + if (columnNode.getType() == CMISParser.COLUMN) { CommonTree columnRefNode = (CommonTree) columnNode.getFirstChildWithType(CMISParser.COLUMN_REF); if (columnRefNode != null) @@ -772,7 +820,15 @@ public class CMISQueryParser } else { - throw new CMISQueryException("Type unsupported in CMIS queries: " + selector.getAlias()); + if (options.getQueryMode() == CMISQueryMode.CMS_STRICT) + { + throw new CMISQueryException("Type unsupported in CMIS queries: " + selector.getAlias()); + } + else + { + typeId = cmisMapping.getCmisTypeId(CMISScope.POLICY, cmisType); + } + } CMISPropertyDefinition definition = cmisDictionaryService.getPropertyDefinition(typeId, columnName); @@ -783,7 +839,8 @@ public class CMISQueryParser Function function = factory.getFunction(PropertyAccessor.NAME); QName propertyQName = cmisMapping.getPropertyQName(definition.getPropertyName()); - Argument arg = factory.createPropertyArgument(PropertyAccessor.ARG_PROPERTY, selector.getAlias(), propertyQName); + Argument arg = factory.createPropertyArgument(PropertyAccessor.ARG_PROPERTY, definition.isQueryable(), definition.isOrderable(), selector.getAlias(), + propertyQName); Map functionArguments = new LinkedHashMap(); functionArguments.put(arg.getName(), arg); @@ -809,7 +866,7 @@ public class CMISQueryParser int childIndex = 2; for (ArgumentDefinition definition : definitions) { - if (functionNode.getChildCount() > childIndex+1) + if (functionNode.getChildCount() > childIndex + 1) { CommonTree argNode = (CommonTree) functionNode.getChild(childIndex++); Argument arg = getFunctionArgument(argNode, definition, factory, selectors); @@ -831,13 +888,12 @@ public class CMISQueryParser } } - - CommonTree rparenNode = (CommonTree)functionNode.getChild(functionNode.getChildCount()-1); - + CommonTree rparenNode = (CommonTree) functionNode.getChild(functionNode.getChildCount() - 1); + int start = getStringPosition(query, functionNode.getLine(), functionNode.getCharPositionInLine()); int end = getStringPosition(query, rparenNode.getLine(), rparenNode.getCharPositionInLine()); - - String alias = query.substring(start, end+1); + + String alias = query.substring(start, end + 1); if (columnNode.getChildCount() > 1) { alias = columnNode.getChild(1).getText(); @@ -852,9 +908,7 @@ public class CMISQueryParser return columns; } - - - + /** * @param query * @param line @@ -866,13 +920,13 @@ public class CMISQueryParser StringTokenizer tokenizer = new StringTokenizer(query, "\n\r\f"); String[] lines = new String[tokenizer.countTokens()]; int i = 0; - while(tokenizer.hasMoreElements()) + while (tokenizer.hasMoreElements()) { lines[i++] = tokenizer.nextToken(); } - + int position = 0; - for(i = 0; i < line-1; i++) + for (i = 0; i < line - 1; i++) { position += lines[i].length(); position++; @@ -884,27 +938,49 @@ public class CMISQueryParser { if (argNode.getType() == CMISParser.COLUMN_REF) { - Argument arg = buildColumnReference(definition.getName(), argNode, factory); + PropertyArgument arg = buildColumnReference(definition.getName(), argNode, factory); + if(!arg.isQueryable()) + { + throw new CMISQueryException("Column refers to unqueryable property "+arg.getPropertyName()); + } + if(!selectors.containsKey(arg.getSelector())) + { + throw new CMISQueryException("No table with alias "+arg.getSelector()); + } return arg; } else if (argNode.getType() == CMISParser.ID) { - Argument arg; String id = argNode.getText(); if (selectors.containsKey(id)) { - arg = factory.createSelectorArgument(definition.getName(), id); + SelectorArgument arg = factory.createSelectorArgument(definition.getName(), id); + if(!arg.isQueryable()) + { + throw new CMISQueryException("Selector is not queryable "+arg.getSelector()); + } + return arg; } else { QName propertyQName = cmisMapping.getPropertyQName(id); - arg = factory.createPropertyArgument(definition.getName(), "", propertyQName); + CMISTypeId typeId = cmisMapping.getCmisTypeForProperty(propertyQName); + CMISPropertyDefinition propDef = cmisDictionaryService.getPropertyDefinition(typeId, id); + PropertyArgument arg = factory.createPropertyArgument(definition.getName(), propDef.isQueryable(), propDef.isOrderable(), "", propertyQName); + if(!arg.isQueryable()) + { + throw new CMISQueryException("Column refers to unqueryable property "+arg.getPropertyName()); + } + return arg; } - return arg; } else if (argNode.getType() == CMISParser.PARAMETER) { - Argument arg = factory.createParameterArgument(definition.getName(), argNode.getText()); + ParameterArgument arg = factory.createParameterArgument(definition.getName(), argNode.getText()); + if(!arg.isQueryable()) + { + throw new CMISQueryException("Parameter is not queryable "+arg.getParameterName()); + } return arg; } else if (argNode.getType() == CMISParser.NUMERIC_LITERAL) @@ -919,7 +995,7 @@ public class CMISQueryParser type = DataTypeDefinition.FLOAT; value = Float.valueOf(value.floatValue()); } - Argument arg = factory.createLiteralArgument(definition.getName(), type, value); + LiteralArgument arg = factory.createLiteralArgument(definition.getName(), type, value); return arg; } else if (literalNode.getType() == CMISParser.DECIMAL_INTEGER_LITERAL) @@ -931,7 +1007,7 @@ public class CMISQueryParser type = DataTypeDefinition.INT; value = Integer.valueOf(value.intValue()); } - Argument arg = factory.createLiteralArgument(definition.getName(), type, value); + LiteralArgument arg = factory.createLiteralArgument(definition.getName(), type, value); return arg; } else @@ -942,8 +1018,8 @@ public class CMISQueryParser else if (argNode.getType() == CMISParser.STRING_LITERAL) { String text = argNode.getChild(0).getText(); - text = text.substring(1, text.length()-1); - Argument arg = factory.createLiteralArgument(definition.getName(), DataTypeDefinition.TEXT, text); + text = text.substring(1, text.length() - 1); + LiteralArgument arg = factory.createLiteralArgument(definition.getName(), DataTypeDefinition.TEXT, text); return arg; } else if (argNode.getType() == CMISParser.LIST) @@ -954,17 +1030,21 @@ public class CMISQueryParser CommonTree arg = (CommonTree) argNode.getChild(i); arguments.add(getFunctionArgument(arg, definition, factory, selectors)); } - Argument arg = factory.createListArgument(definition.getName(), arguments); + ListArgument arg = factory.createListArgument(definition.getName(), arguments); + if(!arg.isQueryable()) + { + throw new CMISQueryException("Not all members of the list are queryable"); + } return arg; } else if (argNode.getType() == CMISParser.ANY) { - Argument arg = factory.createLiteralArgument(definition.getName(), DataTypeDefinition.TEXT, argNode.getText()); + LiteralArgument arg = factory.createLiteralArgument(definition.getName(), DataTypeDefinition.TEXT, argNode.getText()); return arg; } else if (argNode.getType() == CMISParser.NOT) { - Argument arg = factory.createLiteralArgument(definition.getName(), DataTypeDefinition.TEXT, argNode.getText()); + LiteralArgument arg = factory.createLiteralArgument(definition.getName(), DataTypeDefinition.TEXT, argNode.getText()); return arg; } else if (argNode.getType() == CMISParser.FUNCTION) @@ -977,7 +1057,7 @@ public class CMISQueryParser int childIndex = 2; for (ArgumentDefinition currentDefinition : definitions) { - if (argNode.getChildCount() > childIndex+1) + if (argNode.getChildCount() > childIndex + 1) { CommonTree currentArgNode = (CommonTree) argNode.getChild(childIndex++); Argument arg = getFunctionArgument(currentArgNode, currentDefinition, factory, selectors); @@ -997,7 +1077,11 @@ public class CMISQueryParser } } } - Argument arg = factory.createFunctionArgument(definition.getName(), function, functionArguments); + FunctionArgument arg = factory.createFunctionArgument(definition.getName(), function, functionArguments); + if(!arg.isQueryable()) + { + throw new CMISQueryException("Not all function arguments refer to orderable arguments: "+arg.getFunction().getName()); + } return arg; } else @@ -1034,9 +1118,18 @@ public class CMISQueryParser alias = singleTableNode.getChild(1).getText(); } QName classQName = cmisMapping.getAlfrescoClassQNameFromCmisTableName(tableName); - if(classQName == null) + if (classQName == null) { - throw new CMISQueryException("Type is unsupported in query "+tableName); + throw new CMISQueryException("Type is unsupported in query " + tableName); + } + CMISTypeId typeId = cmisMapping.getCmisTypeId(classQName); + if (typeId.getScope() != CMISScope.POLICY) + { + CMISTypeDefinition cmisType = cmisDictionaryService.getType(typeId); + if (!cmisType.isQueryable()) + { + throw new CMISQueryException("Type is not queryable " + tableName + " -> " + cmisType); + } } return factory.createSelector(classQName, alias); } @@ -1058,6 +1151,19 @@ public class CMISQueryParser alias = singleTableNode.getChild(1).getText(); } QName classQName = cmisMapping.getAlfrescoClassQNameFromCmisTableName(tableName); + if (classQName == null) + { + throw new CMISQueryException("Type is unsupported in query " + tableName); + } + CMISTypeId typeId = cmisMapping.getCmisTypeId(classQName); + if (typeId.getScope() != CMISScope.POLICY) + { + CMISTypeDefinition cmisType = cmisDictionaryService.getType(typeId); + if (!cmisType.isQueryable()) + { + throw new CMISQueryException("Type is not queryable " + tableName + " -> " + cmisType); + } + } Source lhs = factory.createSelector(classQName, alias); List list = (List) (source.getChildren()); @@ -1084,9 +1190,17 @@ public class CMISQueryParser CommonTree joinConditionNode = (CommonTree) joinNode.getFirstChildWithType(CMISParser.ON); if (joinConditionNode != null) { - Argument arg1 = buildColumnReference(Equals.ARG_LHS, (CommonTree) joinConditionNode.getChild(0), factory); + PropertyArgument arg1 = buildColumnReference(Equals.ARG_LHS, (CommonTree) joinConditionNode.getChild(0), factory); + if(!lhs.getSelectors().containsKey(arg1.getSelector()) && !rhs.getSelectors().containsKey(arg1.getSelector())) + { + throw new CMISQueryException("No table with alias "+arg1.getSelector()); + } String functionName = getFunctionName((CommonTree) joinConditionNode.getChild(1)); - Argument arg2 = buildColumnReference(Equals.ARG_RHS, (CommonTree) joinConditionNode.getChild(2), factory); + PropertyArgument arg2 = buildColumnReference(Equals.ARG_RHS, (CommonTree) joinConditionNode.getChild(2), factory); + if(!lhs.getSelectors().containsKey(arg2.getSelector()) && !rhs.getSelectors().containsKey(arg2.getSelector())) + { + throw new CMISQueryException("No table with alias "+arg2.getSelector()); + } Function function = factory.getFunction(functionName); Map functionArguments = new LinkedHashMap(); functionArguments.put(arg1.getName(), arg1); @@ -1104,7 +1218,7 @@ public class CMISQueryParser } } - public Argument buildColumnReference(String argumentName, CommonTree columnReferenceNode, QueryModelFactory factory) + public PropertyArgument buildColumnReference(String argumentName, CommonTree columnReferenceNode, QueryModelFactory factory) { String cmisPropertyName = columnReferenceNode.getChild(0).getText(); String qualifer = ""; @@ -1113,7 +1227,17 @@ public class CMISQueryParser qualifer = columnReferenceNode.getChild(1).getText(); } QName propertyQName = cmisMapping.getPropertyQName(cmisPropertyName); - return factory.createPropertyArgument(argumentName, qualifer, propertyQName); + CMISTypeId typeId = cmisMapping.getCmisTypeForProperty(propertyQName); + CMISPropertyDefinition propDef = cmisDictionaryService.getPropertyDefinition(typeId, cmisPropertyName); + if (typeId.getScope() == CMISScope.POLICY) + { + // TODO: Policy - fix to be correct ....when we have properties + return factory.createPropertyArgument(argumentName, true, true, qualifer, propertyQName); + } + else + { + return factory.createPropertyArgument(argumentName, propDef.isQueryable(), propDef.isOrderable(), qualifer, propertyQName); + } } public String getFunctionName(CommonTree functionNameNode) @@ -1132,4 +1256,5 @@ public class CMISQueryParser throw new CMISQueryException("Unknown function: " + functionNameNode.getText()); } } + } diff --git a/source/java/org/alfresco/cmis/search/impl/CMISQueryServiceImpl.java b/source/java/org/alfresco/cmis/search/impl/CMISQueryServiceImpl.java index 11eea95ea3..71e4300f52 100644 --- a/source/java/org/alfresco/cmis/search/impl/CMISQueryServiceImpl.java +++ b/source/java/org/alfresco/cmis/search/impl/CMISQueryServiceImpl.java @@ -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 wrapped = new HashMap(); - wrapped.put(query.getSource().getSelector(), lucene); + Map, ResultSet> map = results.getResults(); + for (Set 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; } diff --git a/source/java/org/alfresco/repo/search/impl/lucene/LuceneQueryParser.java b/source/java/org/alfresco/repo/search/impl/lucene/LuceneQueryParser.java index 8a5c3cd365..015c396a14 100644 --- a/source/java/org/alfresco/repo/search/impl/lucene/LuceneQueryParser.java +++ b/source/java/org/alfresco/repo/search/impl/lucene/LuceneQueryParser.java @@ -341,6 +341,34 @@ public class LuceneQueryParser extends QueryParser reader.parse("//" + queryText); return handler.getQuery(); } + else if(field.equals("CLASS")) + { + ClassDefinition target; + if (queryText.startsWith("{")) + { + target = dictionaryService.getClass(QName.createQName(queryText)); + } + else + { + int colonPosition = queryText.indexOf(':'); + if (colonPosition == -1) + { + // use the default namespace + target = dictionaryService.getClass(QName.createQName(namespacePrefixResolver.getNamespaceURI(""), queryText)); + } + else + { + // find the prefix + target = dictionaryService.getClass(QName.createQName(namespacePrefixResolver.getNamespaceURI(queryText.substring(0, colonPosition)), queryText + .substring(colonPosition + 1))); + } + } + if (target == null) + { + throw new SearcherException("Invalid type: " + queryText); + } + return getFieldQuery(target.isAspect() ? "ASPECT" : "TYPE", queryText); + } else if (field.equals("TYPE")) { TypeDefinition target; diff --git a/source/java/org/alfresco/repo/search/impl/querymodel/Argument.java b/source/java/org/alfresco/repo/search/impl/querymodel/Argument.java index 9186ed6553..598b2f3748 100644 --- a/source/java/org/alfresco/repo/search/impl/querymodel/Argument.java +++ b/source/java/org/alfresco/repo/search/impl/querymodel/Argument.java @@ -37,4 +37,8 @@ public interface Argument public String getName(); public Serializable getValue(FunctionEvaluationContext context); + + public boolean isOrderable(); + + public boolean isQueryable(); } diff --git a/source/java/org/alfresco/repo/search/impl/querymodel/Column.java b/source/java/org/alfresco/repo/search/impl/querymodel/Column.java index 1e155426a7..7a0f2f97c0 100644 --- a/source/java/org/alfresco/repo/search/impl/querymodel/Column.java +++ b/source/java/org/alfresco/repo/search/impl/querymodel/Column.java @@ -38,4 +38,8 @@ public interface Column extends FunctionInvokation * @return */ public String getAlias(); + + public boolean isOrderable(); + + public boolean isQueryable(); } diff --git a/source/java/org/alfresco/repo/search/impl/querymodel/QueryEngine.java b/source/java/org/alfresco/repo/search/impl/querymodel/QueryEngine.java index bbeb0d00e8..e2ebb41b4d 100644 --- a/source/java/org/alfresco/repo/search/impl/querymodel/QueryEngine.java +++ b/source/java/org/alfresco/repo/search/impl/querymodel/QueryEngine.java @@ -24,7 +24,11 @@ */ package org.alfresco.repo.search.impl.querymodel; +import java.util.List; +import java.util.Set; + import org.alfresco.service.cmr.search.ResultSet; +import org.alfresco.util.Pair; /** * @author andyh @@ -32,7 +36,7 @@ import org.alfresco.service.cmr.search.ResultSet; */ public interface QueryEngine { - public ResultSet executeQuery(Query query, String selectorName, QueryOptions options, FunctionEvaluationContext functionContext); + public QueryEngineResults executeQuery(Query query, QueryOptions options, FunctionEvaluationContext functionContext); public QueryModelFactory getQueryModelFactory(); } diff --git a/source/java/org/alfresco/repo/search/impl/querymodel/QueryEngineResults.java b/source/java/org/alfresco/repo/search/impl/querymodel/QueryEngineResults.java new file mode 100644 index 0000000000..9080e2aa02 --- /dev/null +++ b/source/java/org/alfresco/repo/search/impl/querymodel/QueryEngineResults.java @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2005-2007 Alfresco Software Limited. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + * As a special exception to the terms and conditions of version 2.0 of + * the GPL, you may redistribute this Program in connection with Free/Libre + * and Open Source Software ("FLOSS") applications as described in Alfresco's + * FLOSS exception. You should have recieved a copy of the text describing + * the FLOSS exception, and it is also available here: + * http://www.alfresco.com/legal/licensing" + */ +package org.alfresco.repo.search.impl.querymodel; + +import java.util.Map; +import java.util.Set; + +import org.alfresco.service.cmr.search.ResultSet; + +/** + * Encapsulate Query engine results List, ResultSet>> + * + * @author andyh + */ +public class QueryEngineResults +{ + private Map, ResultSet> results; + + public QueryEngineResults(Map, ResultSet> results) + { + this.results = results; + } + + public Map, ResultSet> getResults() + { + return results; + } +} diff --git a/source/java/org/alfresco/repo/search/impl/querymodel/QueryModelFactory.java b/source/java/org/alfresco/repo/search/impl/querymodel/QueryModelFactory.java index 627310167e..2058a54f75 100644 --- a/source/java/org/alfresco/repo/search/impl/querymodel/QueryModelFactory.java +++ b/source/java/org/alfresco/repo/search/impl/querymodel/QueryModelFactory.java @@ -58,7 +58,7 @@ public interface QueryModelFactory public ParameterArgument createParameterArgument(String name, String parameterName); - public PropertyArgument createPropertyArgument(String name, String selectorAlias, QName propertyName); + public PropertyArgument createPropertyArgument(String name, boolean queryable, boolean orderable, String selectorAlias, QName propertyName); public SelectorArgument createSelectorArgument(String name, String selectorAlias); diff --git a/source/java/org/alfresco/repo/search/impl/querymodel/QueryOptions.java b/source/java/org/alfresco/repo/search/impl/querymodel/QueryOptions.java index 99db16c6e0..51a1a3148a 100644 --- a/source/java/org/alfresco/repo/search/impl/querymodel/QueryOptions.java +++ b/source/java/org/alfresco/repo/search/impl/querymodel/QueryOptions.java @@ -45,11 +45,6 @@ public class QueryOptions AND, OR; } - public enum CMISQueryMode - { - STRICT; - } - private String query; private List stores = new ArrayList(1); diff --git a/source/java/org/alfresco/repo/search/impl/querymodel/Source.java b/source/java/org/alfresco/repo/search/impl/querymodel/Source.java index 8e456cc9fc..08d1c67d8e 100644 --- a/source/java/org/alfresco/repo/search/impl/querymodel/Source.java +++ b/source/java/org/alfresco/repo/search/impl/querymodel/Source.java @@ -24,7 +24,9 @@ */ package org.alfresco.repo.search.impl.querymodel; +import java.util.List; import java.util.Map; +import java.util.Set; /** * @author andyh @@ -35,6 +37,6 @@ public interface Source public Map getSelectors(); public Selector getSelector(String name); - - public String getSelector(); + + public List> getSelectorGroups(); } diff --git a/source/java/org/alfresco/repo/search/impl/querymodel/impl/BaseArgument.java b/source/java/org/alfresco/repo/search/impl/querymodel/impl/BaseArgument.java index 1b5d09ae41..c373463322 100644 --- a/source/java/org/alfresco/repo/search/impl/querymodel/impl/BaseArgument.java +++ b/source/java/org/alfresco/repo/search/impl/querymodel/impl/BaseArgument.java @@ -34,10 +34,16 @@ public abstract class BaseArgument implements Argument { private String name; + private boolean queryable; - public BaseArgument(String name) + private boolean orderable; + + + public BaseArgument(String name, boolean queryable, boolean orderable) { this.name = name; + this.queryable = queryable; + this.orderable = orderable; } /* (non-Javadoc) @@ -47,4 +53,14 @@ public abstract class BaseArgument implements Argument { return name; } + + public boolean isOrderable() + { + return orderable; + } + + public boolean isQueryable() + { + return queryable; + } } diff --git a/source/java/org/alfresco/repo/search/impl/querymodel/impl/BaseColumn.java b/source/java/org/alfresco/repo/search/impl/querymodel/impl/BaseColumn.java index 83d87334a8..42bb5f488a 100644 --- a/source/java/org/alfresco/repo/search/impl/querymodel/impl/BaseColumn.java +++ b/source/java/org/alfresco/repo/search/impl/querymodel/impl/BaseColumn.java @@ -83,5 +83,29 @@ public class BaseColumn implements Column builder.append("]"); return builder.toString(); } + + public boolean isOrderable() + { + for(Argument arg : functionArguments.values()) + { + if(!arg.isOrderable()) + { + return false; + } + } + return true; + } + + public boolean isQueryable() + { + for(Argument arg : functionArguments.values()) + { + if(!arg.isQueryable()) + { + return false; + } + } + return true; + } } diff --git a/source/java/org/alfresco/repo/search/impl/querymodel/impl/BaseDynamicArgument.java b/source/java/org/alfresco/repo/search/impl/querymodel/impl/BaseDynamicArgument.java index 5cf88cb923..e4c2ccd8ef 100644 --- a/source/java/org/alfresco/repo/search/impl/querymodel/impl/BaseDynamicArgument.java +++ b/source/java/org/alfresco/repo/search/impl/querymodel/impl/BaseDynamicArgument.java @@ -36,9 +36,9 @@ public abstract class BaseDynamicArgument extends BaseArgument implements Dynami /** * @param name */ - public BaseDynamicArgument(String name) + public BaseDynamicArgument(String name, boolean queryable, boolean orderable) { - super(name); + super(name, queryable, orderable); } } diff --git a/source/java/org/alfresco/repo/search/impl/querymodel/impl/BaseFunctionArgument.java b/source/java/org/alfresco/repo/search/impl/querymodel/impl/BaseFunctionArgument.java index 04e7212407..d46b57b7c2 100644 --- a/source/java/org/alfresco/repo/search/impl/querymodel/impl/BaseFunctionArgument.java +++ b/source/java/org/alfresco/repo/search/impl/querymodel/impl/BaseFunctionArgument.java @@ -45,7 +45,7 @@ public class BaseFunctionArgument extends BaseDynamicArgument implements Functio public BaseFunctionArgument(String name, Function function, Map arguments) { - super(name); + super(name, false, false); this.function = function; this.arguments = arguments; } @@ -85,4 +85,16 @@ public class BaseFunctionArgument extends BaseDynamicArgument implements Functio return builder.toString(); } + public boolean isQueryable() + { + for(Argument arg : arguments.values()) + { + if(!arg.isQueryable()) + { + return false; + } + } + return true; + } + } diff --git a/source/java/org/alfresco/repo/search/impl/querymodel/impl/BaseJoin.java b/source/java/org/alfresco/repo/search/impl/querymodel/impl/BaseJoin.java index 655f0ce3db..7a049b326b 100644 --- a/source/java/org/alfresco/repo/search/impl/querymodel/impl/BaseJoin.java +++ b/source/java/org/alfresco/repo/search/impl/querymodel/impl/BaseJoin.java @@ -24,14 +24,26 @@ */ package org.alfresco.repo.search.impl.querymodel.impl; +import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Map; +import java.util.Set; +import org.alfresco.cmis.dictionary.CMISMapping; +import org.alfresco.model.ContentModel; +import org.alfresco.repo.search.impl.querymodel.Argument; import org.alfresco.repo.search.impl.querymodel.Constraint; +import org.alfresco.repo.search.impl.querymodel.FunctionalConstraint; import org.alfresco.repo.search.impl.querymodel.Join; import org.alfresco.repo.search.impl.querymodel.JoinType; +import org.alfresco.repo.search.impl.querymodel.PropertyArgument; +import org.alfresco.repo.search.impl.querymodel.QueryModelException; import org.alfresco.repo.search.impl.querymodel.Selector; import org.alfresco.repo.search.impl.querymodel.Source; +import org.alfresco.repo.search.impl.querymodel.StaticArgument; +import org.alfresco.repo.search.impl.querymodel.impl.functions.Equals; +import org.alfresco.service.namespace.QName; /** * @author andyh @@ -105,67 +117,142 @@ public class BaseJoin implements Join builder.append("]"); return builder.toString(); } - - - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see org.alfresco.repo.search.impl.querymodel.Source#getSelectorNames() */ public Map getSelectors() { HashMap answer = new HashMap(); Map leftSelectors = left.getSelectors(); - for(String selectorName : leftSelectors.keySet()) + for (String selectorName : leftSelectors.keySet()) { Selector selector = leftSelectors.get(selectorName); - if(answer.put(selectorName, selector) != null) + if (answer.put(selectorName, selector) != null) { - throw new DuplicateSelectorNameException("There is a duplicate selector name for "+selectorName); + throw new DuplicateSelectorNameException("There is a duplicate selector name for " + selectorName); } } Map rightSelectors = right.getSelectors(); - for(String selectorName : rightSelectors.keySet()) + for (String selectorName : rightSelectors.keySet()) { Selector selector = rightSelectors.get(selectorName); - if(answer.put(selectorName, selector) != null) + if (answer.put(selectorName, selector) != null) { - throw new DuplicateSelectorNameException("There is a duplicate selector name for "+selectorName); + throw new DuplicateSelectorNameException("There is a duplicate selector name for " + selectorName); } } return answer; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see org.alfresco.repo.search.impl.querymodel.Source#getSelector(java.lang.String) */ public Selector getSelector(String name) { - HashMap answer = new HashMap(); - Map leftSelectors = left.getSelectors(); - for(String selectorName : leftSelectors.keySet()) - { - Selector selector = leftSelectors.get(selectorName); - if(answer.put(selectorName, selector) != null) - { - throw new DuplicateSelectorNameException("There is a duplicate selector name for "+selectorName); - } - } - Map rightSelectors = right.getSelectors(); - for(String selectorName : rightSelectors.keySet()) - { - Selector selector = rightSelectors.get(selectorName); - if(answer.put(selectorName, selector) != null) - { - throw new DuplicateSelectorNameException("There is a duplicate selector name for "+selectorName); - } - } + Map answer = getSelectors(); return answer.get(name); } - /* (non-Javadoc) - * @see org.alfresco.repo.search.impl.querymodel.Source#getSelector() - */ - public String getSelector() + public List> getSelectorGroups() { - throw new UnsupportedOperationException(); + List> answer = new ArrayList>(); + + List> left = getLeft().getSelectorGroups(); + List> right = getRight().getSelectorGroups(); + + FunctionalConstraint joinCondition = (FunctionalConstraint) getJoinCondition(); + if (!joinCondition.getFunction().getName().equals(Equals.NAME)) + { + throw new UnsupportedOperationException("Only equi-joins are supported"); + } + + Argument lhs = joinCondition.getFunctionArguments().get(Equals.ARG_LHS); + Argument rhs = joinCondition.getFunctionArguments().get(Equals.ARG_RHS); + + String lhsSelector = null; + String rhsSelector = null; + + if (lhs instanceof PropertyArgument) + { + PropertyArgument propertyArgument = (PropertyArgument) lhs; + QName qname = propertyArgument.getPropertyName(); + if (isObjectId(qname)) + { + lhsSelector = propertyArgument.getSelector(); + } + } + + if (rhs instanceof PropertyArgument) + { + PropertyArgument propertyArgument = (PropertyArgument) rhs; + QName qname = propertyArgument.getPropertyName(); + if (isObjectId(qname)) + { + rhsSelector = propertyArgument.getSelector(); + } + } + + if ((getJoinType() == JoinType.INNER) && (lhsSelector != null) && (rhsSelector != null)) + { + + TOADD: for (Set toAddTo : left) + { + if (toAddTo.contains(lhsSelector)) + { + TOMOVE: for (Set toMove : right) + { + if (toMove.contains(rhsSelector)) + { + toAddTo.addAll(toMove); + toMove.clear(); + break TOMOVE; + } + } + break TOADD; + } + if (toAddTo.contains(rhsSelector)) + { + TOMOVE: for (Set toMove : right) + { + if (toMove.contains(lhsSelector)) + { + toAddTo.addAll(toMove); + toMove.clear(); + break TOMOVE; + } + } + break TOADD; + } + } + } + + // remove any empty sets + + for (Set group : left) + { + if (group.size() > 0) + { + answer.add(group); + } + } + for (Set group : right) + { + if (group.size() > 0) + { + answer.add(group); + } + } + + return answer; + } + + private boolean isObjectId(QName qname) + { + return ContentModel.PROP_NODE_DBID.equals(qname) || CMISMapping.PROP_OBJECT_ID_QNAME.equals(qname); } } diff --git a/source/java/org/alfresco/repo/search/impl/querymodel/impl/BaseListArgument.java b/source/java/org/alfresco/repo/search/impl/querymodel/impl/BaseListArgument.java index b10626b6b6..2f70c50fb2 100644 --- a/source/java/org/alfresco/repo/search/impl/querymodel/impl/BaseListArgument.java +++ b/source/java/org/alfresco/repo/search/impl/querymodel/impl/BaseListArgument.java @@ -45,7 +45,7 @@ public class BaseListArgument extends BaseStaticArgument implements ListArgument */ public BaseListArgument(String name, List arguments) { - super(name); + super(name, false, false); this.arguments = arguments; } @@ -81,4 +81,16 @@ public class BaseListArgument extends BaseStaticArgument implements ListArgument builder.append("]"); return builder.toString(); } + + public boolean isQueryable() + { + for(Argument arg : arguments) + { + if(!arg.isQueryable()) + { + return false; + } + } + return true; + } } diff --git a/source/java/org/alfresco/repo/search/impl/querymodel/impl/BaseLiteralArgument.java b/source/java/org/alfresco/repo/search/impl/querymodel/impl/BaseLiteralArgument.java index e505aa025c..6db8f4e733 100644 --- a/source/java/org/alfresco/repo/search/impl/querymodel/impl/BaseLiteralArgument.java +++ b/source/java/org/alfresco/repo/search/impl/querymodel/impl/BaseLiteralArgument.java @@ -42,7 +42,7 @@ public class BaseLiteralArgument extends BaseStaticArgument implements LiteralAr public BaseLiteralArgument(String name, QName type, Serializable value) { - super(name); + super(name, true, false); this.type = type; this.value = value; } @@ -74,5 +74,4 @@ public class BaseLiteralArgument extends BaseStaticArgument implements LiteralAr builder.append("]"); return builder.toString(); } - } diff --git a/source/java/org/alfresco/repo/search/impl/querymodel/impl/BaseParameterArgument.java b/source/java/org/alfresco/repo/search/impl/querymodel/impl/BaseParameterArgument.java index c395db4ac8..19fd209807 100644 --- a/source/java/org/alfresco/repo/search/impl/querymodel/impl/BaseParameterArgument.java +++ b/source/java/org/alfresco/repo/search/impl/querymodel/impl/BaseParameterArgument.java @@ -42,7 +42,7 @@ public class BaseParameterArgument extends BaseStaticArgument implements Paramet */ public BaseParameterArgument(String name, String parameterName) { - super(name); + super(name, true, false); this.parameterName = parameterName; } diff --git a/source/java/org/alfresco/repo/search/impl/querymodel/impl/BasePropertyArgument.java b/source/java/org/alfresco/repo/search/impl/querymodel/impl/BasePropertyArgument.java index 582d4ac7d0..4ad119ad7a 100644 --- a/source/java/org/alfresco/repo/search/impl/querymodel/impl/BasePropertyArgument.java +++ b/source/java/org/alfresco/repo/search/impl/querymodel/impl/BasePropertyArgument.java @@ -43,9 +43,9 @@ public class BasePropertyArgument extends BaseDynamicArgument implements Propert /** * @param name */ - public BasePropertyArgument(String name, String selector, QName propertyName) + public BasePropertyArgument(String name, boolean queryable, boolean orderable, String selector, QName propertyName) { - super(name); + super(name, queryable, orderable); this.selector = selector; this.propertyName = propertyName; diff --git a/source/java/org/alfresco/repo/search/impl/querymodel/impl/BaseSelector.java b/source/java/org/alfresco/repo/search/impl/querymodel/impl/BaseSelector.java index 027769d0e8..d5a2cb804c 100644 --- a/source/java/org/alfresco/repo/search/impl/querymodel/impl/BaseSelector.java +++ b/source/java/org/alfresco/repo/search/impl/querymodel/impl/BaseSelector.java @@ -24,8 +24,13 @@ */ package org.alfresco.repo.search.impl.querymodel.impl; +import java.util.ArrayList; +import java.util.Collections; import java.util.HashMap; +import java.util.HashSet; +import java.util.List; import java.util.Map; +import java.util.Set; import org.alfresco.repo.search.impl.querymodel.Selector; import org.alfresco.service.namespace.QName; @@ -100,11 +105,12 @@ public class BaseSelector implements Selector } } - /* (non-Javadoc) - * @see org.alfresco.repo.search.impl.querymodel.Source#getSelector() - */ - public String getSelector() + public List> getSelectorGroups() { - return getAlias(); + HashSet set = new HashSet(); + set.add(getAlias()); + List> answer = new ArrayList>(); + answer.add(set); + return answer; } } diff --git a/source/java/org/alfresco/repo/search/impl/querymodel/impl/BaseSelectorArgument.java b/source/java/org/alfresco/repo/search/impl/querymodel/impl/BaseSelectorArgument.java index 9d82d2ce45..cb11399c6b 100644 --- a/source/java/org/alfresco/repo/search/impl/querymodel/impl/BaseSelectorArgument.java +++ b/source/java/org/alfresco/repo/search/impl/querymodel/impl/BaseSelectorArgument.java @@ -43,7 +43,7 @@ public class BaseSelectorArgument extends BaseStaticArgument implements Selecto */ public BaseSelectorArgument(String name, String selector) { - super(name); + super(name, true, false); this.selector = selector; } diff --git a/source/java/org/alfresco/repo/search/impl/querymodel/impl/BaseStaticArgument.java b/source/java/org/alfresco/repo/search/impl/querymodel/impl/BaseStaticArgument.java index cae791414f..f78f974b0b 100644 --- a/source/java/org/alfresco/repo/search/impl/querymodel/impl/BaseStaticArgument.java +++ b/source/java/org/alfresco/repo/search/impl/querymodel/impl/BaseStaticArgument.java @@ -36,9 +36,9 @@ public abstract class BaseStaticArgument extends BaseArgument implements StaticA /** * @param name */ - public BaseStaticArgument(String name) + public BaseStaticArgument(String name, boolean queryable, boolean orderable) { - super(name); + super(name, queryable, orderable); } diff --git a/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/LuceneConjunction.java b/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/LuceneConjunction.java index 31d3ebc3df..a55364b89b 100644 --- a/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/LuceneConjunction.java +++ b/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/LuceneConjunction.java @@ -26,6 +26,7 @@ package org.alfresco.repo.search.impl.querymodel.impl.lucene; import java.util.List; import java.util.Map; +import java.util.Set; import org.alfresco.repo.search.impl.lucene.ParseException; import org.alfresco.repo.search.impl.querymodel.Argument; @@ -58,7 +59,7 @@ public class LuceneConjunction extends BaseConjunction implements LuceneQueryBui * java.util.Map, org.alfresco.repo.search.impl.querymodel.impl.lucene.LuceneQueryBuilderContext, * org.alfresco.repo.search.impl.querymodel.FunctionEvaluationContext) */ - public Query addComponent(String selector, Map functionArgs, LuceneQueryBuilderContext luceneContext, FunctionEvaluationContext functionContext) + public Query addComponent(Set selectors, Map functionArgs, LuceneQueryBuilderContext luceneContext, FunctionEvaluationContext functionContext) throws ParseException { BooleanQuery query = new BooleanQuery(); @@ -67,7 +68,7 @@ public class LuceneConjunction extends BaseConjunction implements LuceneQueryBui if (constraint instanceof LuceneQueryBuilderComponent) { LuceneQueryBuilderComponent luceneQueryBuilderComponent = (LuceneQueryBuilderComponent) constraint; - Query constraintQuery = luceneQueryBuilderComponent.addComponent(selector, functionArgs, luceneContext, functionContext); + Query constraintQuery = luceneQueryBuilderComponent.addComponent(selectors, functionArgs, luceneContext, functionContext); if (constraintQuery != null) { if (constraint instanceof Negation) diff --git a/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/LuceneDisjunction.java b/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/LuceneDisjunction.java index fb9588249b..6e70f17fcf 100644 --- a/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/LuceneDisjunction.java +++ b/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/LuceneDisjunction.java @@ -26,6 +26,7 @@ package org.alfresco.repo.search.impl.querymodel.impl.lucene; import java.util.List; import java.util.Map; +import java.util.Set; import org.alfresco.repo.search.impl.lucene.ParseException; import org.alfresco.repo.search.impl.querymodel.Argument; @@ -58,7 +59,7 @@ public class LuceneDisjunction extends BaseDisjunction implements LuceneQueryBui * java.util.Map, org.alfresco.repo.search.impl.querymodel.impl.lucene.LuceneQueryBuilderContext, * org.alfresco.repo.search.impl.querymodel.FunctionEvaluationContext) */ - public Query addComponent(String selector, Map functionArgs, LuceneQueryBuilderContext luceneContext, FunctionEvaluationContext functionContext) + public Query addComponent(Set selectors, Map functionArgs, LuceneQueryBuilderContext luceneContext, FunctionEvaluationContext functionContext) throws ParseException { BooleanQuery query = new BooleanQuery(); @@ -67,7 +68,7 @@ public class LuceneDisjunction extends BaseDisjunction implements LuceneQueryBui if (constraint instanceof LuceneQueryBuilderComponent) { LuceneQueryBuilderComponent luceneQueryBuilderComponent = (LuceneQueryBuilderComponent) constraint; - Query constraintQuery = luceneQueryBuilderComponent.addComponent(selector, functionArgs, luceneContext, functionContext); + Query constraintQuery = luceneQueryBuilderComponent.addComponent(selectors, functionArgs, luceneContext, functionContext); if (constraintQuery != null) { if (constraint instanceof Negation) diff --git a/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/LuceneFunctionalConstraint.java b/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/LuceneFunctionalConstraint.java index 8c79be136f..d519ce9307 100644 --- a/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/LuceneFunctionalConstraint.java +++ b/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/LuceneFunctionalConstraint.java @@ -25,6 +25,7 @@ package org.alfresco.repo.search.impl.querymodel.impl.lucene; import java.util.Map; +import java.util.Set; import org.alfresco.repo.search.impl.lucene.ParseException; import org.alfresco.repo.search.impl.querymodel.Argument; @@ -52,7 +53,7 @@ public class LuceneFunctionalConstraint extends BaseFunctionalConstraint impleme /* (non-Javadoc) * @see org.alfresco.repo.search.impl.querymodel.impl.lucene.LuceneQueryBuilderComponent#addComponent(org.apache.lucene.search.BooleanQuery, org.apache.lucene.search.BooleanQuery, org.alfresco.service.cmr.dictionary.DictionaryService, java.lang.String) */ - public Query addComponent(String selector, Map functionArgs, LuceneQueryBuilderContext luceneContext, FunctionEvaluationContext functionContext) throws ParseException + public Query addComponent(Set selectors, Map functionArgs, LuceneQueryBuilderContext luceneContext, FunctionEvaluationContext functionContext) throws ParseException { Function function = getFunction(); if(function != null) @@ -60,7 +61,7 @@ public class LuceneFunctionalConstraint extends BaseFunctionalConstraint impleme if(function instanceof LuceneQueryBuilderComponent) { LuceneQueryBuilderComponent luceneQueryBuilderComponent = (LuceneQueryBuilderComponent)function; - return luceneQueryBuilderComponent.addComponent(selector, getFunctionArguments(), luceneContext, functionContext); + return luceneQueryBuilderComponent.addComponent(selectors, getFunctionArguments(), luceneContext, functionContext); } else { diff --git a/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/LuceneNegation.java b/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/LuceneNegation.java index 1a62220aae..d1933e9c2c 100644 --- a/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/LuceneNegation.java +++ b/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/LuceneNegation.java @@ -25,6 +25,7 @@ package org.alfresco.repo.search.impl.querymodel.impl.lucene; import java.util.Map; +import java.util.Set; import org.alfresco.repo.search.impl.lucene.ParseException; import org.alfresco.repo.search.impl.querymodel.Argument; @@ -54,13 +55,13 @@ public class LuceneNegation extends BaseNegation implements LuceneQueryBuilderCo * java.util.Map, org.alfresco.repo.search.impl.querymodel.impl.lucene.LuceneQueryBuilderContext, * org.alfresco.repo.search.impl.querymodel.FunctionEvaluationContext) */ - public Query addComponent(String selector, Map functionArgs, LuceneQueryBuilderContext luceneContext, FunctionEvaluationContext functionContext) + public Query addComponent(Set selectors, Map functionArgs, LuceneQueryBuilderContext luceneContext, FunctionEvaluationContext functionContext) throws ParseException { if (getConstraint() instanceof LuceneQueryBuilderComponent) { LuceneQueryBuilderComponent luceneQueryBuilderComponent = (LuceneQueryBuilderComponent) getConstraint(); - Query constraintQuery = luceneQueryBuilderComponent.addComponent(selector, functionArgs, luceneContext, functionContext); + Query constraintQuery = luceneQueryBuilderComponent.addComponent(selectors, functionArgs, luceneContext, functionContext); if (constraintQuery == null) { throw new UnsupportedOperationException(); diff --git a/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/LucenePropertyArgument.java b/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/LucenePropertyArgument.java index e24c909a68..d467a7e237 100644 --- a/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/LucenePropertyArgument.java +++ b/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/LucenePropertyArgument.java @@ -38,9 +38,9 @@ public class LucenePropertyArgument extends BasePropertyArgument * @param name * @param propertyName */ - public LucenePropertyArgument(String name, String selector, QName propertyName) + public LucenePropertyArgument(String name, boolean queryable, boolean orderable, String selector, QName propertyName) { - super(name, selector, propertyName); + super(name, queryable, orderable, selector, propertyName); } } diff --git a/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/LuceneQuery.java b/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/LuceneQuery.java index 2797d31ac4..c30c5dd762 100644 --- a/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/LuceneQuery.java +++ b/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/LuceneQuery.java @@ -25,11 +25,13 @@ package org.alfresco.repo.search.impl.querymodel.impl.lucene; import java.util.List; +import java.util.Set; import org.alfresco.repo.search.impl.lucene.ParseException; import org.alfresco.repo.search.impl.querymodel.Column; import org.alfresco.repo.search.impl.querymodel.Constraint; import org.alfresco.repo.search.impl.querymodel.FunctionEvaluationContext; +import org.alfresco.repo.search.impl.querymodel.Join; import org.alfresco.repo.search.impl.querymodel.Negation; import org.alfresco.repo.search.impl.querymodel.Order; import org.alfresco.repo.search.impl.querymodel.Ordering; @@ -68,17 +70,18 @@ public class LuceneQuery extends BaseQuery implements LuceneQueryBuilder * * @see org.alfresco.repo.search.impl.querymodel.impl.lucene.LuceneQueryBuilder#buildQuery() */ - public Query buildQuery(String selectorName, LuceneQueryBuilderContext luceneContext, FunctionEvaluationContext functionContext) throws ParseException + public Query buildQuery(Set selectors, LuceneQueryBuilderContext luceneContext, FunctionEvaluationContext functionContext) throws ParseException { BooleanQuery luceneQuery = new BooleanQuery(); - Selector selector = getSource().getSelector(selectorName); - if (selector != null) + + for (String selector : selectors) { - if (selector instanceof LuceneQueryBuilderComponent) + Selector current = getSource().getSelector(selector); + if (current instanceof LuceneQueryBuilderComponent) { - LuceneQueryBuilderComponent luceneQueryBuilderComponent = (LuceneQueryBuilderComponent) selector; - Query selectorQuery = luceneQueryBuilderComponent.addComponent(selectorName, null, luceneContext, functionContext); + LuceneQueryBuilderComponent luceneQueryBuilderComponent = (LuceneQueryBuilderComponent) current; + Query selectorQuery = luceneQueryBuilderComponent.addComponent(selectors, null, luceneContext, functionContext); if (selectorQuery != null) { luceneQuery.add(selectorQuery, Occur.MUST); @@ -89,10 +92,6 @@ public class LuceneQuery extends BaseQuery implements LuceneQueryBuilder throw new UnsupportedOperationException(); } } - else - { - throw new UnsupportedOperationException(); - } Constraint constraint = getConstraint(); if (constraint != null) @@ -100,7 +99,7 @@ public class LuceneQuery extends BaseQuery implements LuceneQueryBuilder if (constraint instanceof LuceneQueryBuilderComponent) { LuceneQueryBuilderComponent luceneQueryBuilderComponent = (LuceneQueryBuilderComponent) constraint; - Query constraintQuery = luceneQueryBuilderComponent.addComponent(selectorName, null, luceneContext, functionContext); + Query constraintQuery = luceneQueryBuilderComponent.addComponent(selectors, null, luceneContext, functionContext); if (constraintQuery != null) { if (constraint instanceof Negation) @@ -134,7 +133,7 @@ public class LuceneQuery extends BaseQuery implements LuceneQueryBuilder * org.alfresco.repo.search.impl.querymodel.impl.lucene.LuceneQueryBuilderContext, * org.alfresco.repo.search.impl.querymodel.FunctionEvaluationContext) */ - public Sort buildSort(String selectorName, LuceneQueryBuilderContext luceneContext, FunctionEvaluationContext functionContext) + public Sort buildSort(Set selectors, LuceneQueryBuilderContext luceneContext, FunctionEvaluationContext functionContext) { if ((getOrderings() == null) || (getOrderings().size() == 0)) { @@ -168,7 +167,7 @@ public class LuceneQuery extends BaseQuery implements LuceneQueryBuilder throw new IllegalStateException(); } } - else if(ordering.getColumn().getFunction().getName().equals(Score.NAME)) + else if (ordering.getColumn().getFunction().getName().equals(Score.NAME)) { fields[index++] = new SortField(null, SortField.SCORE, !(ordering.getOrder() == Order.DESCENDING)); } diff --git a/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/LuceneQueryBuilder.java b/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/LuceneQueryBuilder.java index e2819edfd8..20f84bc9d0 100644 --- a/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/LuceneQueryBuilder.java +++ b/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/LuceneQueryBuilder.java @@ -24,6 +24,8 @@ */ package org.alfresco.repo.search.impl.querymodel.impl.lucene; +import java.util.Set; + import org.alfresco.repo.search.impl.lucene.ParseException; import org.alfresco.repo.search.impl.querymodel.FunctionEvaluationContext; import org.apache.lucene.search.Query; @@ -34,7 +36,7 @@ import org.apache.lucene.search.Sort; */ public interface LuceneQueryBuilder { - public Query buildQuery(String selectorName, LuceneQueryBuilderContext luceneContext, FunctionEvaluationContext functionContext) throws ParseException; + public Query buildQuery(Set selectors, LuceneQueryBuilderContext luceneContext, FunctionEvaluationContext functionContext) throws ParseException; - public Sort buildSort(String selectorName, LuceneQueryBuilderContext luceneContext, FunctionEvaluationContext functionContext); + public Sort buildSort(Set selectors, LuceneQueryBuilderContext luceneContext, FunctionEvaluationContext functionContext); } diff --git a/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/LuceneQueryBuilderComponent.java b/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/LuceneQueryBuilderComponent.java index 7b71d065af..9807670817 100644 --- a/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/LuceneQueryBuilderComponent.java +++ b/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/LuceneQueryBuilderComponent.java @@ -25,6 +25,7 @@ package org.alfresco.repo.search.impl.querymodel.impl.lucene; import java.util.Map; +import java.util.Set; import org.alfresco.repo.search.impl.lucene.ParseException; import org.alfresco.repo.search.impl.querymodel.Argument; @@ -36,5 +37,5 @@ import org.apache.lucene.search.Query; */ public interface LuceneQueryBuilderComponent { - public Query addComponent(String selector, Map functionArgs, LuceneQueryBuilderContext luceneContext, FunctionEvaluationContext functionContext) throws ParseException; + public Query addComponent(Set selectors, Map functionArgs, LuceneQueryBuilderContext luceneContext, FunctionEvaluationContext functionContext) throws ParseException; } diff --git a/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/LuceneQueryEngine.java b/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/LuceneQueryEngine.java index a6a035e48e..7a63dd04e1 100644 --- a/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/LuceneQueryEngine.java +++ b/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/LuceneQueryEngine.java @@ -25,6 +25,10 @@ package org.alfresco.repo.search.impl.querymodel.impl.lucene; import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; import org.alfresco.repo.search.SearcherException; import org.alfresco.repo.search.impl.lucene.ClosingIndexSearcher; @@ -35,6 +39,7 @@ import org.alfresco.repo.search.impl.lucene.ParseException; import org.alfresco.repo.search.impl.querymodel.FunctionEvaluationContext; 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.repo.search.impl.querymodel.QueryModelFactory; import org.alfresco.repo.search.impl.querymodel.QueryOptions; import org.alfresco.repo.tenant.TenantService; @@ -46,6 +51,7 @@ import org.alfresco.service.cmr.search.ResultSet; import org.alfresco.service.cmr.search.SearchParameters; import org.alfresco.service.cmr.search.SearchService; import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.util.Pair; import org.apache.lucene.search.Hits; import org.apache.lucene.search.Sort; @@ -114,8 +120,22 @@ public class LuceneQueryEngine implements QueryEngine return new LuceneQueryModelFactory(); } - public ResultSet executeQuery(Query query, String selectorName, QueryOptions options, FunctionEvaluationContext functionContext) + public QueryEngineResults executeQuery(Query query, QueryOptions options, FunctionEvaluationContext functionContext) { + List> selectorGroups = query.getSource().getSelectorGroups(); + + if(selectorGroups.size() == 0) + { + throw new UnsupportedOperationException("No selectors"); + } + + if(selectorGroups.size() > 1) + { + throw new UnsupportedOperationException("Advanced join is not supported"); + } + + Set selectorGroup = selectorGroups.get(0); + SearchParameters searchParameters = new SearchParameters(); searchParameters.setBulkFetch(options.getFetchSize() > 0); searchParameters.setBulkFetchSize(options.getFetchSize()); @@ -143,10 +163,10 @@ public class LuceneQueryEngine implements QueryEngine searcher.getIndexReader()); LuceneQueryBuilder builder = (LuceneQueryBuilder) query; - org.apache.lucene.search.Query luceneQuery = builder.buildQuery(selectorName, luceneContext, functionContext); + org.apache.lucene.search.Query luceneQuery = builder.buildQuery(selectorGroup, luceneContext, functionContext); //System.out.println(luceneQuery); - Sort sort = builder.buildSort(selectorName, luceneContext, functionContext); + Sort sort = builder.buildSort(selectorGroup, luceneContext, functionContext); Hits hits; @@ -159,8 +179,10 @@ public class LuceneQueryEngine implements QueryEngine hits = searcher.search(luceneQuery, sort); } - return new LuceneResultSet(hits, searcher, nodeService, tenantService, null, searchParameters, indexAndSearcher); - + LuceneResultSet result = new LuceneResultSet(hits, searcher, nodeService, tenantService, null, searchParameters, indexAndSearcher); + Map, ResultSet> map = new HashMap, ResultSet>(1); + map.put(selectorGroup, result); + return new QueryEngineResults(map); } else { @@ -181,4 +203,5 @@ public class LuceneQueryEngine implements QueryEngine throw new SearcherException("IO exception during search", e); } } + } diff --git a/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/LuceneQueryModelFactory.java b/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/LuceneQueryModelFactory.java index ae82d2598a..af6947587b 100644 --- a/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/LuceneQueryModelFactory.java +++ b/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/LuceneQueryModelFactory.java @@ -223,9 +223,9 @@ public class LuceneQueryModelFactory implements QueryModelFactory * @see org.alfresco.repo.search.impl.querymodel.QueryModelFactory#createPropertyArgument(java.lang.String, * org.alfresco.service.namespace.QName) */ - public PropertyArgument createPropertyArgument(String name, String selector, QName propertyName) + public PropertyArgument createPropertyArgument(String name, boolean queryable, boolean orderable, String selector, QName propertyName) { - return new LucenePropertyArgument(name, selector, propertyName); + return new LucenePropertyArgument(name, queryable, orderable, selector, propertyName); } /* diff --git a/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/LuceneSelector.java b/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/LuceneSelector.java index e2eaa98711..fc3968b3d8 100644 --- a/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/LuceneSelector.java +++ b/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/LuceneSelector.java @@ -25,6 +25,7 @@ package org.alfresco.repo.search.impl.querymodel.impl.lucene; import java.util.Map; +import java.util.Set; import org.alfresco.repo.search.impl.lucene.LuceneQueryParser; import org.alfresco.repo.search.impl.lucene.ParseException; @@ -53,10 +54,10 @@ public class LuceneSelector extends BaseSelector implements LuceneQueryBuilderCo /* (non-Javadoc) * @see org.alfresco.repo.search.impl.querymodel.impl.lucene.LuceneQueryBuilderComponent#addComponent(org.apache.lucene.search.BooleanQuery, org.apache.lucene.search.BooleanQuery) */ - public Query addComponent(String selector, Map functionArgs, LuceneQueryBuilderContext luceneContext, FunctionEvaluationContext functionContext) throws ParseException + public Query addComponent(Set selectors, Map functionArgs, LuceneQueryBuilderContext luceneContext, FunctionEvaluationContext functionContext) throws ParseException { LuceneQueryParser lqp = luceneContext.getLuceneQueryParser(); - return lqp.getFieldQuery("TYPE", getType().toString()); + return lqp.getFieldQuery("CLASS", getType().toString()); } diff --git a/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/functions/LuceneChild.java b/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/functions/LuceneChild.java index 021ad6453a..34a1eca85f 100644 --- a/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/functions/LuceneChild.java +++ b/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/functions/LuceneChild.java @@ -26,6 +26,7 @@ package org.alfresco.repo.search.impl.querymodel.impl.lucene.functions; import java.io.Serializable; import java.util.Map; +import java.util.Set; import org.alfresco.model.ContentModel; import org.alfresco.repo.search.impl.lucene.LuceneQueryParser; @@ -62,7 +63,7 @@ public class LuceneChild extends Child implements LuceneQueryBuilderComponent * org.apache.lucene.search.BooleanQuery, org.alfresco.service.cmr.dictionary.DictionaryService, * java.lang.String) */ - public Query addComponent(String selector, Map functionArgs, LuceneQueryBuilderContext luceneContext, FunctionEvaluationContext functionContext) + public Query addComponent(Set selectors, Map functionArgs, LuceneQueryBuilderContext luceneContext, FunctionEvaluationContext functionContext) throws ParseException { LuceneQueryParser lqp = luceneContext.getLuceneQueryParser(); diff --git a/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/functions/LuceneDescendant.java b/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/functions/LuceneDescendant.java index d1c8d6491c..4bfcb0b73c 100644 --- a/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/functions/LuceneDescendant.java +++ b/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/functions/LuceneDescendant.java @@ -26,6 +26,7 @@ package org.alfresco.repo.search.impl.querymodel.impl.lucene.functions; import java.io.Serializable; import java.util.Map; +import java.util.Set; import org.alfresco.model.ContentModel; import org.alfresco.repo.search.impl.lucene.LuceneQueryParser; @@ -63,7 +64,7 @@ public class LuceneDescendant extends Descendant implements LuceneQueryBuilderCo * org.apache.lucene.search.BooleanQuery, org.alfresco.service.cmr.dictionary.DictionaryService, * java.lang.String) */ - public Query addComponent(String selector, Map functionArgs, LuceneQueryBuilderContext luceneContext, FunctionEvaluationContext functionContext) + public Query addComponent(Set selectors, Map functionArgs, LuceneQueryBuilderContext luceneContext, FunctionEvaluationContext functionContext) throws ParseException { LuceneQueryParser lqp = luceneContext.getLuceneQueryParser(); diff --git a/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/functions/LuceneEquals.java b/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/functions/LuceneEquals.java index 9366086b9a..0d4190b0f7 100644 --- a/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/functions/LuceneEquals.java +++ b/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/functions/LuceneEquals.java @@ -25,6 +25,7 @@ package org.alfresco.repo.search.impl.querymodel.impl.lucene.functions; import java.util.Map; +import java.util.Set; import org.alfresco.repo.search.impl.lucene.LuceneQueryParser; import org.alfresco.repo.search.impl.lucene.ParseException; @@ -55,7 +56,7 @@ public class LuceneEquals extends Equals implements LuceneQueryBuilderComponent * org.apache.lucene.search.BooleanQuery, org.alfresco.service.cmr.dictionary.DictionaryService, * java.lang.String) */ - public Query addComponent(String selector, Map functionArgs, LuceneQueryBuilderContext luceneContext, FunctionEvaluationContext functionContext) + public Query addComponent(Set selectors, Map functionArgs, LuceneQueryBuilderContext luceneContext, FunctionEvaluationContext functionContext) throws ParseException { LuceneQueryParser lqp = luceneContext.getLuceneQueryParser(); diff --git a/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/functions/LuceneExists.java b/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/functions/LuceneExists.java index 5610bea4bb..d3d52ac10d 100644 --- a/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/functions/LuceneExists.java +++ b/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/functions/LuceneExists.java @@ -25,6 +25,7 @@ package org.alfresco.repo.search.impl.querymodel.impl.lucene.functions; import java.util.Map; +import java.util.Set; import org.alfresco.repo.search.impl.lucene.LuceneQueryParser; import org.alfresco.repo.search.impl.lucene.ParseException; @@ -52,7 +53,7 @@ public class LuceneExists extends Exists implements LuceneQueryBuilderComponent super(); } - public Query addComponent(String selector, Map functionArgs, LuceneQueryBuilderContext luceneContext, FunctionEvaluationContext functionContext) + public Query addComponent(Set selectors, Map functionArgs, LuceneQueryBuilderContext luceneContext, FunctionEvaluationContext functionContext) throws ParseException { LuceneQueryParser lqp = luceneContext.getLuceneQueryParser(); diff --git a/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/functions/LuceneFTSExactTerm.java b/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/functions/LuceneFTSExactTerm.java index 02762b388a..b79234ad3a 100644 --- a/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/functions/LuceneFTSExactTerm.java +++ b/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/functions/LuceneFTSExactTerm.java @@ -25,6 +25,7 @@ package org.alfresco.repo.search.impl.querymodel.impl.lucene.functions; import java.util.Map; +import java.util.Set; import org.alfresco.repo.search.impl.lucene.LuceneQueryParser; import org.alfresco.repo.search.impl.lucene.ParseException; @@ -56,7 +57,7 @@ public class LuceneFTSExactTerm extends FTSExactTerm implements LuceneQueryBuild * org.apache.lucene.search.BooleanQuery, org.alfresco.service.cmr.dictionary.DictionaryService, * java.lang.String) */ - public Query addComponent(String selector, Map functionArgs, LuceneQueryBuilderContext luceneContext, FunctionEvaluationContext functionContext) + public Query addComponent(Set selectors, Map functionArgs, LuceneQueryBuilderContext luceneContext, FunctionEvaluationContext functionContext) throws ParseException { LuceneQueryParser lqp = luceneContext.getLuceneQueryParser(); diff --git a/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/functions/LuceneFTSPhrase.java b/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/functions/LuceneFTSPhrase.java index 06cba4bfa5..c09b966a25 100644 --- a/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/functions/LuceneFTSPhrase.java +++ b/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/functions/LuceneFTSPhrase.java @@ -25,6 +25,7 @@ package org.alfresco.repo.search.impl.querymodel.impl.lucene.functions; import java.util.Map; +import java.util.Set; import org.alfresco.repo.search.impl.lucene.LuceneQueryParser; import org.alfresco.repo.search.impl.lucene.ParseException; @@ -56,7 +57,7 @@ public class LuceneFTSPhrase extends FTSPhrase implements LuceneQueryBuilderComp * org.apache.lucene.search.BooleanQuery, org.alfresco.service.cmr.dictionary.DictionaryService, * java.lang.String) */ - public Query addComponent(String selector, Map functionArgs, LuceneQueryBuilderContext luceneContext, FunctionEvaluationContext functionContext) + public Query addComponent(Set selectors, Map functionArgs, LuceneQueryBuilderContext luceneContext, FunctionEvaluationContext functionContext) throws ParseException { LuceneQueryParser lqp = luceneContext.getLuceneQueryParser(); diff --git a/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/functions/LuceneFTSTerm.java b/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/functions/LuceneFTSTerm.java index d7f17d57c2..891184a0bd 100644 --- a/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/functions/LuceneFTSTerm.java +++ b/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/functions/LuceneFTSTerm.java @@ -25,6 +25,7 @@ package org.alfresco.repo.search.impl.querymodel.impl.lucene.functions; import java.util.Map; +import java.util.Set; import org.alfresco.repo.search.impl.lucene.LuceneQueryParser; import org.alfresco.repo.search.impl.lucene.ParseException; @@ -55,7 +56,7 @@ public class LuceneFTSTerm extends FTSTerm implements LuceneQueryBuilderComponen * org.apache.lucene.search.BooleanQuery, org.alfresco.service.cmr.dictionary.DictionaryService, * java.lang.String) */ - public Query addComponent(String selector, Map functionArgs, LuceneQueryBuilderContext luceneContext, FunctionEvaluationContext functionContext) + public Query addComponent(Set selectors, Map functionArgs, LuceneQueryBuilderContext luceneContext, FunctionEvaluationContext functionContext) throws ParseException { LuceneQueryParser lqp = luceneContext.getLuceneQueryParser(); diff --git a/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/functions/LuceneGreaterThan.java b/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/functions/LuceneGreaterThan.java index 0d34cbfb1b..3aac7d0431 100644 --- a/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/functions/LuceneGreaterThan.java +++ b/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/functions/LuceneGreaterThan.java @@ -25,6 +25,7 @@ package org.alfresco.repo.search.impl.querymodel.impl.lucene.functions; import java.util.Map; +import java.util.Set; import org.alfresco.repo.search.impl.lucene.LuceneQueryParser; import org.alfresco.repo.search.impl.lucene.ParseException; @@ -58,7 +59,7 @@ public class LuceneGreaterThan extends GreaterThan implements LuceneQueryBuilder * org.apache.lucene.search.BooleanQuery, org.alfresco.service.cmr.dictionary.DictionaryService, * java.lang.String) */ - public Query addComponent(String selector, Map functionArgs, LuceneQueryBuilderContext luceneContext, FunctionEvaluationContext functionContext) + public Query addComponent(Set selectors, Map functionArgs, LuceneQueryBuilderContext luceneContext, FunctionEvaluationContext functionContext) throws ParseException { LuceneQueryParser lqp = luceneContext.getLuceneQueryParser(); diff --git a/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/functions/LuceneGreaterThanOrEquals.java b/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/functions/LuceneGreaterThanOrEquals.java index 03cbbe8f5e..7f4bce0570 100644 --- a/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/functions/LuceneGreaterThanOrEquals.java +++ b/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/functions/LuceneGreaterThanOrEquals.java @@ -25,6 +25,7 @@ package org.alfresco.repo.search.impl.querymodel.impl.lucene.functions; import java.util.Map; +import java.util.Set; import org.alfresco.repo.search.impl.lucene.LuceneQueryParser; import org.alfresco.repo.search.impl.lucene.ParseException; @@ -59,7 +60,7 @@ public class LuceneGreaterThanOrEquals extends GreaterThanOrEquals implements Lu * org.apache.lucene.search.BooleanQuery, org.alfresco.service.cmr.dictionary.DictionaryService, * java.lang.String) */ - public Query addComponent(String selector, Map functionArgs, LuceneQueryBuilderContext luceneContext, FunctionEvaluationContext functionContext) + public Query addComponent(Set selectors, Map functionArgs, LuceneQueryBuilderContext luceneContext, FunctionEvaluationContext functionContext) throws ParseException { LuceneQueryParser lqp = luceneContext.getLuceneQueryParser(); diff --git a/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/functions/LuceneIn.java b/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/functions/LuceneIn.java index 8016e80e18..2b0b84efb7 100644 --- a/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/functions/LuceneIn.java +++ b/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/functions/LuceneIn.java @@ -27,6 +27,7 @@ package org.alfresco.repo.search.impl.querymodel.impl.lucene.functions; import java.io.Serializable; import java.util.Collection; import java.util.Map; +import java.util.Set; import org.alfresco.repo.search.impl.lucene.LuceneQueryParser; import org.alfresco.repo.search.impl.lucene.ParseException; @@ -63,7 +64,7 @@ public class LuceneIn extends In implements LuceneQueryBuilderComponent * java.lang.String) */ @SuppressWarnings("unchecked") - public Query addComponent(String selector, Map functionArgs, LuceneQueryBuilderContext luceneContext, FunctionEvaluationContext functionContext) + public Query addComponent(Set selectors, Map functionArgs, LuceneQueryBuilderContext luceneContext, FunctionEvaluationContext functionContext) throws ParseException { LuceneQueryParser lqp = luceneContext.getLuceneQueryParser(); diff --git a/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/functions/LuceneLessThan.java b/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/functions/LuceneLessThan.java index 126902d343..abb9910927 100644 --- a/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/functions/LuceneLessThan.java +++ b/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/functions/LuceneLessThan.java @@ -25,6 +25,7 @@ package org.alfresco.repo.search.impl.querymodel.impl.lucene.functions; import java.util.Map; +import java.util.Set; import org.alfresco.repo.search.impl.lucene.LuceneQueryParser; import org.alfresco.repo.search.impl.lucene.ParseException; @@ -59,7 +60,7 @@ public class LuceneLessThan extends LessThan implements LuceneQueryBuilderCompon * org.apache.lucene.search.BooleanQuery, org.alfresco.service.cmr.dictionary.DictionaryService, * java.lang.String) */ - public Query addComponent(String selector, Map functionArgs, LuceneQueryBuilderContext luceneContext, FunctionEvaluationContext functionContext) + public Query addComponent(Set selectors, Map functionArgs, LuceneQueryBuilderContext luceneContext, FunctionEvaluationContext functionContext) throws ParseException { LuceneQueryParser lqp = luceneContext.getLuceneQueryParser(); diff --git a/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/functions/LuceneLessThanOrEquals.java b/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/functions/LuceneLessThanOrEquals.java index 176cd70123..9d057c0d6b 100644 --- a/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/functions/LuceneLessThanOrEquals.java +++ b/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/functions/LuceneLessThanOrEquals.java @@ -25,6 +25,7 @@ package org.alfresco.repo.search.impl.querymodel.impl.lucene.functions; import java.util.Map; +import java.util.Set; import org.alfresco.repo.search.impl.lucene.LuceneQueryParser; import org.alfresco.repo.search.impl.lucene.ParseException; @@ -59,7 +60,7 @@ public class LuceneLessThanOrEquals extends LessThanOrEquals implements LuceneQu * org.apache.lucene.search.BooleanQuery, org.alfresco.service.cmr.dictionary.DictionaryService, * java.lang.String) */ - public Query addComponent(String selector, Map functionArgs, LuceneQueryBuilderContext luceneContext, FunctionEvaluationContext functionContext) + public Query addComponent(Set selectors, Map functionArgs, LuceneQueryBuilderContext luceneContext, FunctionEvaluationContext functionContext) throws ParseException { LuceneQueryParser lqp = luceneContext.getLuceneQueryParser(); diff --git a/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/functions/LuceneLike.java b/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/functions/LuceneLike.java index 44de816eb9..700897cd5d 100644 --- a/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/functions/LuceneLike.java +++ b/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/functions/LuceneLike.java @@ -26,6 +26,7 @@ package org.alfresco.repo.search.impl.querymodel.impl.lucene.functions; import java.io.Serializable; import java.util.Map; +import java.util.Set; import org.alfresco.repo.search.impl.lucene.LuceneQueryParser; import org.alfresco.repo.search.impl.lucene.ParseException; @@ -61,7 +62,7 @@ public class LuceneLike extends Like implements LuceneQueryBuilderComponent * org.apache.lucene.search.BooleanQuery, org.alfresco.service.cmr.dictionary.DictionaryService, * java.lang.String) */ - public Query addComponent(String selector, Map functionArgs, LuceneQueryBuilderContext luceneContext, FunctionEvaluationContext functionContext) + public Query addComponent(Set selectors, Map functionArgs, LuceneQueryBuilderContext luceneContext, FunctionEvaluationContext functionContext) throws ParseException { LuceneQueryParser lqp = luceneContext.getLuceneQueryParser(); diff --git a/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/functions/LuceneNotEquals.java b/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/functions/LuceneNotEquals.java index 2f18d1ef7c..41fec1b88c 100644 --- a/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/functions/LuceneNotEquals.java +++ b/source/java/org/alfresco/repo/search/impl/querymodel/impl/lucene/functions/LuceneNotEquals.java @@ -25,6 +25,7 @@ package org.alfresco.repo.search.impl.querymodel.impl.lucene.functions; import java.util.Map; +import java.util.Set; import org.alfresco.repo.search.impl.lucene.LuceneQueryParser; import org.alfresco.repo.search.impl.lucene.ParseException; @@ -59,7 +60,7 @@ public class LuceneNotEquals extends NotEquals implements LuceneQueryBuilderComp * org.apache.lucene.search.BooleanQuery, org.alfresco.service.cmr.dictionary.DictionaryService, * java.lang.String) */ - public Query addComponent(String selector, Map functionArgs, LuceneQueryBuilderContext luceneContext, FunctionEvaluationContext functionContext) + public Query addComponent(Set selectors, Map functionArgs, LuceneQueryBuilderContext luceneContext, FunctionEvaluationContext functionContext) throws ParseException { LuceneQueryParser lqp = luceneContext.getLuceneQueryParser(); diff --git a/source/java/org/alfresco/repo/security/permissions/impl/acegi/ACLEntryAfterInvocationProvider.java b/source/java/org/alfresco/repo/security/permissions/impl/acegi/ACLEntryAfterInvocationProvider.java index 40c780f3bc..24cd6ce50a 100644 --- a/source/java/org/alfresco/repo/security/permissions/impl/acegi/ACLEntryAfterInvocationProvider.java +++ b/source/java/org/alfresco/repo/security/permissions/impl/acegi/ACLEntryAfterInvocationProvider.java @@ -27,9 +27,11 @@ package org.alfresco.repo.security.permissions.impl.acegi; import java.util.ArrayList; import java.util.BitSet; import java.util.Collection; +import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; +import java.util.Map; import java.util.Set; import java.util.StringTokenizer; @@ -40,6 +42,7 @@ import net.sf.acegisecurity.ConfigAttributeDefinition; import net.sf.acegisecurity.afterinvocation.AfterInvocationProvider; import org.alfresco.repo.search.SimpleResultSetMetaData; +import org.alfresco.repo.search.impl.querymodel.QueryEngineResults; import org.alfresco.repo.security.authentication.AuthenticationUtil; import org.alfresco.repo.security.permissions.impl.SimplePermissionReference; import org.alfresco.service.cmr.model.FileInfo; @@ -251,6 +254,14 @@ public class ACLEntryAfterInvocationProvider implements AfterInvocationProvider, } return decide(authentication, object, config, (ResultSet) returnedObject); } + else if (QueryEngineResults.class.isAssignableFrom(returnedObject.getClass())) + { + if (log.isDebugEnabled()) + { + log.debug("Result Set access"); + } + return decide(authentication, object, config, (QueryEngineResults) returnedObject); + } else if (Collection.class.isAssignableFrom(returnedObject.getClass())) { if (log.isDebugEnabled()) @@ -510,6 +521,22 @@ public class ACLEntryAfterInvocationProvider implements AfterInvocationProvider, return filteringResultSet; } + private QueryEngineResults decide(Authentication authentication, Object object, ConfigAttributeDefinition config, + QueryEngineResults returnedObject) throws AccessDeniedException + + { + Map, ResultSet> map = returnedObject.getResults(); + Map, ResultSet> answer = new HashMap, ResultSet>(map.size(), 1.0f); + + for (Set group : map.keySet()) + { + ResultSet raw = map.get(group); + ResultSet permed = decide(authentication, object, config, raw); + answer.put(group, permed); + } + return new QueryEngineResults(answer); + } + private Collection decide(Authentication authentication, Object object, ConfigAttributeDefinition config, Collection returnedObject) throws AccessDeniedException