mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-15 15:02:20 +00:00
Merge from SEAMIST3
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@10735 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -24,6 +24,10 @@
|
||||
*/
|
||||
package org.alfresco.cmis.search;
|
||||
|
||||
import org.alfresco.cmis.CMISFullTextSearchEnum;
|
||||
import org.alfresco.cmis.CMISJoinEnum;
|
||||
import org.alfresco.cmis.CMISQueryEnum;
|
||||
|
||||
/**
|
||||
* Support to execute CMIS queries
|
||||
*
|
||||
@@ -48,21 +52,34 @@ public interface CMISQueryService
|
||||
*/
|
||||
public CMISResultSet query(String query);
|
||||
|
||||
|
||||
/**
|
||||
* Can you query non-latest versions of a document.
|
||||
* The current latest version is always searchable according to the type definition.
|
||||
* @return
|
||||
* Get the query support level
|
||||
*/
|
||||
public boolean getAllVersionsSearchable();
|
||||
public CMISQueryEnum getQuerySupport();
|
||||
|
||||
/**
|
||||
* Get the join support level in queries.
|
||||
* @return
|
||||
*/
|
||||
public JoinSupport getJoinSupport();
|
||||
public CMISJoinEnum getJoinSupport();
|
||||
|
||||
/**
|
||||
* Get the full text search support level in queries.
|
||||
*/
|
||||
public FullTextSearchSupport getFullTextSearchSupport();
|
||||
public CMISFullTextSearchEnum getFullTextSearchSupport();
|
||||
|
||||
/**
|
||||
* Can you query Private Working Copies of a document.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean getPwcSearchable();
|
||||
|
||||
/**
|
||||
* Can you query non-latest versions of a document.
|
||||
* The current latest version is always searchable according to the type definition.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean getAllVersionsSearchable();
|
||||
}
|
||||
|
@@ -24,8 +24,8 @@
|
||||
*/
|
||||
package org.alfresco.cmis.search;
|
||||
|
||||
import org.alfresco.cmis.CMISPropertyTypeEnum;
|
||||
import org.alfresco.cmis.dictionary.CMISPropertyDefinition;
|
||||
import org.alfresco.cmis.dictionary.CMISPropertyType;
|
||||
|
||||
/**
|
||||
* The column meta data for a result set
|
||||
@@ -51,5 +51,5 @@ public interface CMISResultSetColumn
|
||||
* The type of the column
|
||||
* @return - the CMIS type for the column
|
||||
*/
|
||||
public CMISPropertyType getPropertyType();
|
||||
public CMISPropertyTypeEnum getPropertyType();
|
||||
}
|
||||
|
@@ -24,8 +24,8 @@
|
||||
*/
|
||||
package org.alfresco.cmis.search;
|
||||
|
||||
import org.alfresco.cmis.CMISPropertyTypeEnum;
|
||||
import org.alfresco.cmis.dictionary.CMISPropertyDefinition;
|
||||
import org.alfresco.cmis.dictionary.CMISPropertyType;
|
||||
|
||||
/**
|
||||
* @author andyh
|
||||
@@ -38,9 +38,9 @@ public class CMISResultSetColumnImpl implements CMISResultSetColumn
|
||||
|
||||
private CMISPropertyDefinition propertyDefinition;
|
||||
|
||||
private CMISPropertyType propertyType;
|
||||
private CMISPropertyTypeEnum propertyType;
|
||||
|
||||
CMISResultSetColumnImpl(String name, CMISPropertyDefinition propertyDefinition, CMISPropertyType propertyType)
|
||||
CMISResultSetColumnImpl(String name, CMISPropertyDefinition propertyDefinition, CMISPropertyTypeEnum propertyType)
|
||||
{
|
||||
this.name = name;
|
||||
this.propertyDefinition = propertyDefinition;
|
||||
@@ -67,7 +67,7 @@ public class CMISResultSetColumnImpl implements CMISResultSetColumn
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.cmis.search.CMISResultSetColumn#getPropertyType()
|
||||
*/
|
||||
public CMISPropertyType getPropertyType()
|
||||
public CMISPropertyTypeEnum getPropertyType()
|
||||
{
|
||||
return propertyType;
|
||||
}
|
||||
|
@@ -28,9 +28,9 @@ import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.cmis.CMISPropertyTypeEnum;
|
||||
import org.alfresco.cmis.dictionary.CMISDictionaryService;
|
||||
import org.alfresco.cmis.dictionary.CMISPropertyDefinition;
|
||||
import org.alfresco.cmis.dictionary.CMISPropertyType;
|
||||
import org.alfresco.cmis.dictionary.CMISTypeDefinition;
|
||||
import org.alfresco.repo.search.impl.querymodel.Column;
|
||||
import org.alfresco.repo.search.impl.querymodel.PropertyArgument;
|
||||
@@ -75,7 +75,7 @@ public class CMISResultSetMetaDataImpl implements CMISResultSetMetaData
|
||||
for (Column column : query.getColumns())
|
||||
{
|
||||
CMISPropertyDefinition propertyDefinition = null;
|
||||
CMISPropertyType type = null;
|
||||
CMISPropertyTypeEnum type = null;
|
||||
if (column.getFunction().getName().equals(PropertyAccessor.NAME))
|
||||
{
|
||||
PropertyArgument arg = (PropertyArgument) column.getFunctionArguments().get(PropertyAccessor.ARG_PROPERTY);
|
||||
|
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
* 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.cmis.search;
|
||||
|
||||
/**
|
||||
* @author andyh
|
||||
*
|
||||
*/
|
||||
public enum FullTextSearchSupport
|
||||
{
|
||||
NO_FULL_TEXT, FULL_TEXT_ONLY, FULL_TEXT_AND_STRUCTURED;
|
||||
}
|
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
* 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.cmis.search;
|
||||
|
||||
/**
|
||||
* @author andyh
|
||||
*
|
||||
*/
|
||||
public enum JoinSupport
|
||||
{
|
||||
NO_JOIN_SUPPORT, INNER_JOIN_SUPPORT, INNER_AND_OUTER_JOIN_SUPPORT;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@@ -32,7 +32,8 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import org.alfresco.cmis.dictionary.CMISCardinality;
|
||||
import org.alfresco.cmis.CMISCardinalityEnum;
|
||||
import org.alfresco.cmis.CMISJoinEnum;
|
||||
import org.alfresco.cmis.dictionary.CMISDictionaryService;
|
||||
import org.alfresco.cmis.dictionary.CMISMapping;
|
||||
import org.alfresco.cmis.dictionary.CMISPropertyDefinition;
|
||||
@@ -40,7 +41,6 @@ import org.alfresco.cmis.dictionary.CMISScope;
|
||||
import org.alfresco.cmis.dictionary.CMISTypeId;
|
||||
import org.alfresco.cmis.search.CMISQueryException;
|
||||
import org.alfresco.cmis.search.CMISQueryOptions;
|
||||
import org.alfresco.cmis.search.JoinSupport;
|
||||
import org.alfresco.repo.search.impl.parsers.CMISLexer;
|
||||
import org.alfresco.repo.search.impl.parsers.CMISParser;
|
||||
import org.alfresco.repo.search.impl.parsers.FTSLexer;
|
||||
@@ -95,9 +95,9 @@ public class CMISQueryParser
|
||||
|
||||
private CMISMapping cmisMapping;
|
||||
|
||||
private JoinSupport joinSupport;
|
||||
private CMISJoinEnum joinSupport;
|
||||
|
||||
public CMISQueryParser(CMISQueryOptions options, CMISDictionaryService cmisDictionaryService, CMISMapping cmisMapping, JoinSupport joinSupport)
|
||||
public CMISQueryParser(CMISQueryOptions options, CMISDictionaryService cmisDictionaryService, CMISMapping cmisMapping, CMISJoinEnum joinSupport)
|
||||
{
|
||||
this.options = options;
|
||||
this.cmisDictionaryService = cmisDictionaryService;
|
||||
@@ -685,7 +685,7 @@ public class CMISQueryParser
|
||||
Map<String, CMISPropertyDefinition> propDefs = cmisDictionaryService.getPropertyDefinitions(typeId);
|
||||
for (CMISPropertyDefinition definition : propDefs.values())
|
||||
{
|
||||
if (definition.getCardinality() == CMISCardinality.SINGLE_VALUED)
|
||||
if (definition.getCardinality() == CMISCardinalityEnum.SINGLE_VALUED)
|
||||
{
|
||||
Function function = factory.getFunction(PropertyAccessor.NAME);
|
||||
QName propertyQName = cmisMapping.getPropertyQName(definition.getPropertyName());
|
||||
@@ -730,7 +730,7 @@ public class CMISQueryParser
|
||||
Map<String, CMISPropertyDefinition> propDefs = cmisDictionaryService.getPropertyDefinitions(typeId);
|
||||
for (CMISPropertyDefinition definition : propDefs.values())
|
||||
{
|
||||
if (definition.getCardinality() == CMISCardinality.SINGLE_VALUED)
|
||||
if (definition.getCardinality() == CMISCardinalityEnum.SINGLE_VALUED)
|
||||
{
|
||||
Function function = factory.getFunction(PropertyAccessor.NAME);
|
||||
QName propertyQName = cmisMapping.getPropertyQName(definition.getPropertyName());
|
||||
@@ -1007,7 +1007,7 @@ public class CMISQueryParser
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private Source buildSource(CommonTree source, JoinSupport joinSupport, QueryModelFactory factory)
|
||||
private Source buildSource(CommonTree source, CMISJoinEnum joinSupport, QueryModelFactory factory)
|
||||
{
|
||||
if (source.getChildCount() == 1)
|
||||
{
|
||||
@@ -1015,7 +1015,7 @@ public class CMISQueryParser
|
||||
CommonTree singleTableNode = (CommonTree) source.getChild(0);
|
||||
if (singleTableNode.getType() == CMISParser.TABLE)
|
||||
{
|
||||
if (joinSupport == JoinSupport.NO_JOIN_SUPPORT)
|
||||
if (joinSupport == CMISJoinEnum.NO_JOIN_SUPPORT)
|
||||
{
|
||||
throw new UnsupportedOperationException("Joins are not supported");
|
||||
}
|
||||
@@ -1042,7 +1042,7 @@ public class CMISQueryParser
|
||||
}
|
||||
else
|
||||
{
|
||||
if (joinSupport == JoinSupport.NO_JOIN_SUPPORT)
|
||||
if (joinSupport == CMISJoinEnum.NO_JOIN_SUPPORT)
|
||||
{
|
||||
throw new UnsupportedOperationException("Joins are not supported");
|
||||
}
|
||||
@@ -1075,7 +1075,7 @@ public class CMISQueryParser
|
||||
joinType = JoinType.LEFT;
|
||||
}
|
||||
|
||||
if ((joinType == JoinType.LEFT) && (joinSupport == JoinSupport.INNER_JOIN_SUPPORT))
|
||||
if ((joinType == JoinType.LEFT) && (joinSupport == CMISJoinEnum.INNER_JOIN_SUPPORT))
|
||||
{
|
||||
throw new UnsupportedOperationException("Outer joins are not supported");
|
||||
}
|
||||
|
@@ -27,7 +27,10 @@ package org.alfresco.cmis.search.impl;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.cmis.CMISQueryEnum;
|
||||
import org.alfresco.cmis.CMISService;
|
||||
import org.alfresco.cmis.CMISFullTextSearchEnum;
|
||||
import org.alfresco.cmis.CMISJoinEnum;
|
||||
import org.alfresco.cmis.dictionary.CMISDictionaryService;
|
||||
import org.alfresco.cmis.dictionary.CMISMapping;
|
||||
import org.alfresco.cmis.property.CMISPropertyService;
|
||||
@@ -36,8 +39,6 @@ import org.alfresco.cmis.search.CMISQueryService;
|
||||
import org.alfresco.cmis.search.CMISResultSet;
|
||||
import org.alfresco.cmis.search.CMISResultSetImpl;
|
||||
import org.alfresco.cmis.search.CmisFunctionEvaluationContext;
|
||||
import org.alfresco.cmis.search.FullTextSearchSupport;
|
||||
import org.alfresco.cmis.search.JoinSupport;
|
||||
import org.alfresco.repo.search.impl.querymodel.Query;
|
||||
import org.alfresco.repo.search.impl.querymodel.QueryEngine;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
@@ -123,7 +124,6 @@ public class CMISQueryServiceImpl implements CMISQueryService
|
||||
{
|
||||
CMISQueryParser parser = new CMISQueryParser(options, cmisDictionaryService, cmisMapping, getJoinSupport());
|
||||
Query query = parser.parse(queryEngine.getQueryModelFactory());
|
||||
System.out.println(query);
|
||||
|
||||
CmisFunctionEvaluationContext functionContext = new CmisFunctionEvaluationContext();
|
||||
functionContext.setCmisDictionaryService(cmisDictionaryService);
|
||||
@@ -148,6 +148,16 @@ public class CMISQueryServiceImpl implements CMISQueryService
|
||||
return query(options);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.alfresco.cmis.search.CMISQueryService#getPwcSearchable()
|
||||
*/
|
||||
public boolean getPwcSearchable()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
@@ -158,14 +168,24 @@ public class CMISQueryServiceImpl implements CMISQueryService
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.alfresco.cmis.search.CMISQueryService#getQuerySupport()
|
||||
*/
|
||||
public CMISQueryEnum getQuerySupport()
|
||||
{
|
||||
return CMISQueryEnum.BOTH;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.alfresco.cmis.search.CMISQueryService#getFullTextSearchSupport()
|
||||
*/
|
||||
public FullTextSearchSupport getFullTextSearchSupport()
|
||||
public CMISFullTextSearchEnum getFullTextSearchSupport()
|
||||
{
|
||||
return FullTextSearchSupport.FULL_TEXT_AND_STRUCTURED;
|
||||
return CMISFullTextSearchEnum.FULL_TEXT_AND_STRUCTURED;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -173,9 +193,8 @@ public class CMISQueryServiceImpl implements CMISQueryService
|
||||
*
|
||||
* @see org.alfresco.cmis.search.CMISQueryService#getJoinSupport()
|
||||
*/
|
||||
public JoinSupport getJoinSupport()
|
||||
public CMISJoinEnum getJoinSupport()
|
||||
{
|
||||
return JoinSupport.NO_JOIN_SUPPORT;
|
||||
return CMISJoinEnum.NO_JOIN_SUPPORT;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user