mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merge from SEAMIST3
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@10730 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
351
source/java/org/alfresco/cmis/search/CMISQueryOptions.java
Normal file
351
source/java/org/alfresco/cmis/search/CMISQueryOptions.java
Normal file
@@ -0,0 +1,351 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.alfresco.i18n.I18NUtil;
|
||||
import org.alfresco.repo.search.MLAnalysisMode;
|
||||
import org.alfresco.service.cmr.repository.StoreRef;
|
||||
import org.alfresco.service.cmr.search.QueryParameterDefinition;
|
||||
|
||||
/**
|
||||
* The options for a CMIS query
|
||||
*
|
||||
* @author andyh
|
||||
*/
|
||||
public class CMISQueryOptions
|
||||
{
|
||||
public enum Connective
|
||||
{
|
||||
AND, OR;
|
||||
}
|
||||
|
||||
public enum CMISQueryMode
|
||||
{
|
||||
STRICT;
|
||||
}
|
||||
|
||||
private String query;
|
||||
|
||||
private List<StoreRef> stores = new ArrayList<StoreRef>(1);
|
||||
|
||||
private int maxItems = -1;
|
||||
|
||||
private int skipCount = 0;
|
||||
|
||||
private Connective defaultFTSConnective = Connective.AND;
|
||||
|
||||
private Connective defaultFTSFieldConnective = Connective.AND;
|
||||
|
||||
private CMISQueryMode queryMode = CMISQueryMode.STRICT;
|
||||
|
||||
private int fetchSize = 1000;
|
||||
|
||||
private List<Locale> locales = new ArrayList<Locale>(1);
|
||||
|
||||
private MLAnalysisMode mlAnalaysisMode = MLAnalysisMode.EXACT_LANGUAGE_AND_ALL;
|
||||
|
||||
private List<QueryParameterDefinition> queryParameterDefinitions = new ArrayList<QueryParameterDefinition>(4);
|
||||
|
||||
private boolean includeInTransactionData = true;
|
||||
|
||||
/**
|
||||
* Create a CMISQueryOptions instance with the default options other than the query and store ref.
|
||||
* The query will be run using the locale returned by I18NUtil.getLocale()
|
||||
*
|
||||
* @param query - the query to run
|
||||
* @param storeRef - the store against which to run the query
|
||||
*/
|
||||
public CMISQueryOptions(String query, StoreRef storeRef)
|
||||
{
|
||||
this(query, storeRef, I18NUtil.getLocale());
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a CMISQueryOptions instance with the default options other than the query, store ref and locale.
|
||||
*
|
||||
* @param query - the query to run
|
||||
* @param storeRef - the store against which to run the query
|
||||
*/
|
||||
public CMISQueryOptions(String query, StoreRef storeRef, Locale locale)
|
||||
{
|
||||
this.query = query;
|
||||
this.stores.add(storeRef);
|
||||
this.locales.add(locale);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the query string
|
||||
*
|
||||
* @return the query
|
||||
*/
|
||||
public String getQuery()
|
||||
{
|
||||
return query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the query string
|
||||
*
|
||||
* @param query the query to set
|
||||
*/
|
||||
public void setQuery(String query)
|
||||
{
|
||||
this.query = query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list of stores in which to run the query.
|
||||
* Only one store is supported at the momentOnly one store is supported at the moment
|
||||
*
|
||||
* @return the stores
|
||||
*/
|
||||
public List<StoreRef> getStores()
|
||||
{
|
||||
return stores;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the stores against which to run the query.
|
||||
* Only one store is supported at the moment.
|
||||
*
|
||||
* @param stores the stores to set
|
||||
*/
|
||||
public void setStores(List<StoreRef> stores)
|
||||
{
|
||||
this.stores = stores;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the max number of rows for the result set
|
||||
* 0 or less is unlimited
|
||||
*
|
||||
* @return the maxItems
|
||||
*/
|
||||
public int getMaxItems()
|
||||
{
|
||||
return maxItems;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the max number of rows for the result set
|
||||
* 0 or less is unlimited
|
||||
*
|
||||
* @param maxItems the maxItems to set
|
||||
*/
|
||||
public void setMaxItems(int maxItems)
|
||||
{
|
||||
this.maxItems = maxItems;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the skip count - the number of rows to skip at the start of the query.
|
||||
*
|
||||
* @return the skipCount
|
||||
*/
|
||||
public int getSkipCount()
|
||||
{
|
||||
return skipCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the skip count - the number of rows to skip at the start of the query.
|
||||
*
|
||||
* @param skipCount the skipCount to set
|
||||
*/
|
||||
public void setSkipCount(int skipCount)
|
||||
{
|
||||
this.skipCount = skipCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default connective used when OR and AND are not specified for the FTS contains() function.
|
||||
*
|
||||
* @return the defaultFTSConnective
|
||||
*/
|
||||
public Connective getDefaultFTSConnective()
|
||||
{
|
||||
return defaultFTSConnective;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the default connective used when OR and AND are not specified for the FTS contains() function.
|
||||
*
|
||||
* @param defaultFTSConnective the defaultFTSConnective to set
|
||||
*/
|
||||
public void setDefaultFTSConnective(Connective defaultFTSConnective)
|
||||
{
|
||||
this.defaultFTSConnective = defaultFTSConnective;
|
||||
}
|
||||
|
||||
/**
|
||||
* As getDefaultFTSConnective() but for field groups
|
||||
*
|
||||
* @return the defaultFTSFieldConnective
|
||||
*/
|
||||
public Connective getDefaultFTSFieldConnective()
|
||||
{
|
||||
return defaultFTSFieldConnective;
|
||||
}
|
||||
|
||||
/**
|
||||
* As setDefaultFTSConnective() but for field groups
|
||||
*
|
||||
* @param defaultFTSFieldConnective the defaultFTSFieldConnective to set
|
||||
*/
|
||||
public void setDefaultFTSFieldConnective(Connective defaultFTSFieldConnective)
|
||||
{
|
||||
this.defaultFTSFieldConnective = defaultFTSFieldConnective;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the query mode.
|
||||
*
|
||||
* @return the queryMode
|
||||
*/
|
||||
public CMISQueryMode getQueryMode()
|
||||
{
|
||||
return queryMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the query mode.
|
||||
*
|
||||
* @param queryMode the queryMode to set
|
||||
*/
|
||||
public void setQueryMode(CMISQueryMode queryMode)
|
||||
{
|
||||
this.queryMode = queryMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the fetch size
|
||||
* 0 - no prefetch
|
||||
* -1 - prefetch all
|
||||
*
|
||||
* @return the fetchSize
|
||||
*/
|
||||
public int getFetchSize()
|
||||
{
|
||||
return fetchSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the fetch size
|
||||
* 0 - no prefetch
|
||||
* -1 - prefetch all
|
||||
*
|
||||
* @param fetchSize the fetchSize to set
|
||||
*/
|
||||
public void setFetchSize(int fetchSize)
|
||||
{
|
||||
this.fetchSize = fetchSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list of locales to use for the query
|
||||
*
|
||||
* @return the locales
|
||||
*/
|
||||
public List<Locale> getLocales()
|
||||
{
|
||||
return locales;
|
||||
}
|
||||
|
||||
/**
|
||||
* sSet the list of locales to use for the query
|
||||
*
|
||||
* @param locales the locales to set
|
||||
*/
|
||||
public void setLocales(List<Locale> locales)
|
||||
{
|
||||
this.locales = locales;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the mode for multi-lingual text analaysis
|
||||
*
|
||||
* @return the mlAnalaysisMode
|
||||
*/
|
||||
public MLAnalysisMode getMlAnalaysisMode()
|
||||
{
|
||||
return mlAnalaysisMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the mode for multi-lingual text analaysis
|
||||
*
|
||||
* @param mlAnalaysisMode the mlAnalaysisMode to set
|
||||
*/
|
||||
public void setMlAnalaysisMode(MLAnalysisMode mlAnalaysisMode)
|
||||
{
|
||||
this.mlAnalaysisMode = mlAnalaysisMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the query parameters
|
||||
*
|
||||
* @return the queryParameterDefinitions
|
||||
*/
|
||||
public List<QueryParameterDefinition> getQueryParameterDefinitions()
|
||||
{
|
||||
return queryParameterDefinitions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the query parameters
|
||||
*
|
||||
* @param queryParameterDefinitions the queryParameterDefinitions to set
|
||||
*/
|
||||
public void setQueryParameterDefinitions(List<QueryParameterDefinition> queryParameterDefinitions)
|
||||
{
|
||||
this.queryParameterDefinitions = queryParameterDefinitions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Does the search include any changes made in the current transaction?
|
||||
*
|
||||
* @return the includeInTransactionData
|
||||
*/
|
||||
public boolean isIncludeInTransactionData()
|
||||
{
|
||||
return includeInTransactionData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set to true if the search include any changes made in the current transaction.
|
||||
*
|
||||
* @param includeInTransactionData the includeInTransactionData to set
|
||||
*/
|
||||
public void setIncludeInTransactionData(boolean includeInTransactionData)
|
||||
{
|
||||
this.includeInTransactionData = includeInTransactionData;
|
||||
}
|
||||
|
||||
|
||||
}
|
68
source/java/org/alfresco/cmis/search/CMISQueryService.java
Normal file
68
source/java/org/alfresco/cmis/search/CMISQueryService.java
Normal file
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* Support to execute CMIS queries
|
||||
*
|
||||
* @author andyh
|
||||
*
|
||||
*/
|
||||
public interface CMISQueryService
|
||||
{
|
||||
/**
|
||||
* Execute a CMIS query as defined by options
|
||||
*
|
||||
* @param options
|
||||
* @return a result set
|
||||
*/
|
||||
public CMISResultSet query(CMISQueryOptions options);
|
||||
|
||||
/**
|
||||
* Execute a CMIS query with all the default options;
|
||||
*
|
||||
* @param query
|
||||
* @return
|
||||
*/
|
||||
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
|
||||
*/
|
||||
public boolean getAllVersionsSearchable();
|
||||
|
||||
/**
|
||||
* Get the join support level in queries.
|
||||
* @return
|
||||
*/
|
||||
public JoinSupport getJoinSupport();
|
||||
|
||||
/**
|
||||
* Get the full text search support level in queries.
|
||||
*/
|
||||
public FullTextSearchSupport getFullTextSearchSupport();
|
||||
}
|
84
source/java/org/alfresco/cmis/search/CMISResultSet.java
Normal file
84
source/java/org/alfresco/cmis/search/CMISResultSet.java
Normal file
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
|
||||
/**
|
||||
* A CMIS result set
|
||||
*
|
||||
* @author andyh
|
||||
*
|
||||
*/
|
||||
public interface CMISResultSet extends Iterable<CMISResultSetRow>
|
||||
{
|
||||
/**
|
||||
* Get the result set meta-data.
|
||||
* @return
|
||||
*/
|
||||
public CMISResultSetMetaData getMetaData();
|
||||
|
||||
/**
|
||||
* 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 when executing the query.
|
||||
* @return
|
||||
*/
|
||||
public int start();
|
||||
|
||||
/**
|
||||
* Get the number of rows in this result set.
|
||||
*
|
||||
* This will be less than or equal to the maximum number of rows requested or
|
||||
* the full length if no restriction on length is specified.
|
||||
*
|
||||
* If a skip count is given, the length represents the number of results
|
||||
* after the skip count and does not include the items skipped.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public int length();
|
||||
|
||||
/**
|
||||
* Close the result set and release any resources held/
|
||||
* The result set is also bound to the transaction and will auto close at
|
||||
* the end of the transaction.
|
||||
*/
|
||||
public void close();
|
||||
|
||||
/**
|
||||
* Was this result set curtailed - are there more pages to the result set?
|
||||
* @return
|
||||
*/
|
||||
public boolean hasMore();
|
||||
|
||||
|
||||
/**
|
||||
* Get the given row
|
||||
* @param i -the position in this result set - start + i gives the position in the overall result set
|
||||
* @return
|
||||
*/
|
||||
public CMISResultSetRow getRow(int i);
|
||||
|
||||
}
|
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import org.alfresco.cmis.dictionary.CMISPropertyDefinition;
|
||||
import org.alfresco.cmis.dictionary.CMISPropertyType;
|
||||
|
||||
/**
|
||||
* The column meta data for a result set
|
||||
*
|
||||
* @author andyh
|
||||
*
|
||||
*/
|
||||
public interface CMISResultSetColumn
|
||||
{
|
||||
/**
|
||||
* The column name
|
||||
* @return - the column name
|
||||
*/
|
||||
public String getName();
|
||||
|
||||
/**
|
||||
* The property definition if there is one for the column
|
||||
* @return - the property definition or null if it does not make sense for the column
|
||||
*/
|
||||
public CMISPropertyDefinition getPropertyDefinition();
|
||||
|
||||
/**
|
||||
* The type of the column
|
||||
* @return - the CMIS type for the column
|
||||
*/
|
||||
public CMISPropertyType getPropertyType();
|
||||
}
|
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* The meta data associated with a result set
|
||||
*
|
||||
* @author andyh
|
||||
*
|
||||
*/
|
||||
public interface CMISResultSetMetaData
|
||||
{
|
||||
/**
|
||||
* The selector meta-data.
|
||||
* @return - the selector meta-data.
|
||||
*/
|
||||
public CMISResultSetSelector[] getSelectors();
|
||||
|
||||
/**
|
||||
* The column meta-data.
|
||||
* @return - the column meta-data.
|
||||
*/
|
||||
public CMISResultSetColumn[] getColumns();
|
||||
|
||||
/**
|
||||
* Get the query options used to create this result set
|
||||
* @return the query options
|
||||
*/
|
||||
public CMISQueryOptions getQueryOptions();
|
||||
|
||||
/**
|
||||
* Get the names of the selectors.
|
||||
* @return - the selector names.
|
||||
*/
|
||||
public String[] getSelectorNames();
|
||||
|
||||
/**
|
||||
* Get the column names.
|
||||
* @return - the names of the columns.
|
||||
*/
|
||||
public String[] getColumnNames();
|
||||
|
||||
/**
|
||||
* Get the selector meta-data by name.
|
||||
* @param name
|
||||
* @return - the selector meta-data.
|
||||
*/
|
||||
public CMISResultSetSelector getSelector(String name);
|
||||
|
||||
/**
|
||||
* Get the column meta-data by column name.
|
||||
* @param name
|
||||
* @return - the column meta-data.
|
||||
*/
|
||||
public CMISResultSetColumn getCoumn(String name);
|
||||
}
|
83
source/java/org/alfresco/cmis/search/CMISResultSetRow.java
Normal file
83
source/java/org/alfresco/cmis/search/CMISResultSetRow.java
Normal file
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* A row in a CMISResultSet
|
||||
*
|
||||
* @author andyh
|
||||
*
|
||||
*/
|
||||
public interface CMISResultSetRow
|
||||
{
|
||||
/**
|
||||
* Get all the column data.
|
||||
* @return - a map of serializable column values with teh column name as the key
|
||||
*/
|
||||
public Map<String, Serializable> getValues();
|
||||
|
||||
/**
|
||||
* Get the data for a single column
|
||||
* @param columnName
|
||||
* @return the value
|
||||
*/
|
||||
public Serializable getValue(String columnName);
|
||||
|
||||
/**
|
||||
* Get the overall score.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public float getScore();
|
||||
|
||||
/**
|
||||
* Get the scores .
|
||||
* @return a map of selector name to score.
|
||||
*/
|
||||
public Map<String, Float> getScores();
|
||||
|
||||
/**
|
||||
* Get the score related to the names selector.
|
||||
* @param selectorName
|
||||
* @return - the score.
|
||||
*/
|
||||
public float getScore(String selectorName);
|
||||
|
||||
/**
|
||||
* Get the index of this result set in the result set
|
||||
* If you want the overall position in paged reults you have to add the skipCount fo the result set.
|
||||
* @return
|
||||
*/
|
||||
public int getIndex();
|
||||
|
||||
/**
|
||||
* Get the result set for which this row is a member.
|
||||
* @return - the result set.
|
||||
*/
|
||||
public CMISResultSet getResultSet();
|
||||
}
|
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import org.alfresco.cmis.dictionary.CMISTypeDefinition;
|
||||
|
||||
/**
|
||||
* The meta-data for a result set selector.
|
||||
*
|
||||
* @author andyh
|
||||
*
|
||||
*/
|
||||
public interface CMISResultSetSelector
|
||||
{
|
||||
/**
|
||||
* The name of the selector
|
||||
* @return - the selector name
|
||||
*/
|
||||
public String getName();
|
||||
|
||||
/**
|
||||
* Get the type definition for the selector.
|
||||
* @return - the CMIS type definition.
|
||||
*/
|
||||
public CMISTypeDefinition getTypeDefinition();
|
||||
|
||||
}
|
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* 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;
|
||||
}
|
34
source/java/org/alfresco/cmis/search/JoinSupport.java
Normal file
34
source/java/org/alfresco/cmis/search/JoinSupport.java
Normal file
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* 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
1078
source/java/org/alfresco/cmis/search/impl/CMISQueryParser.java
Normal file
1078
source/java/org/alfresco/cmis/search/impl/CMISQueryParser.java
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,120 @@
|
||||
/*
|
||||
* 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.impl;
|
||||
|
||||
import org.alfresco.cmis.CMISService;
|
||||
import org.alfresco.cmis.dictionary.CMISDictionaryService;
|
||||
import org.alfresco.cmis.dictionary.CMISMapping;
|
||||
import org.alfresco.cmis.search.CMISQueryOptions;
|
||||
import org.alfresco.cmis.search.CMISQueryService;
|
||||
import org.alfresco.cmis.search.CMISResultSet;
|
||||
import org.alfresco.cmis.search.FullTextSearchSupport;
|
||||
import org.alfresco.cmis.search.JoinSupport;
|
||||
import org.alfresco.repo.search.impl.querymodel.Query;
|
||||
|
||||
/**
|
||||
* @author andyh
|
||||
*/
|
||||
public class CMISQueryServiceImpl implements CMISQueryService
|
||||
{
|
||||
private CMISService cmisService;
|
||||
|
||||
private CMISDictionaryService cmisDictionaryService;
|
||||
|
||||
private CMISMapping cmisMapping;
|
||||
|
||||
/**
|
||||
* @param service the service to set
|
||||
*/
|
||||
public void setCmisService(CMISService cmisService)
|
||||
{
|
||||
this.cmisService = cmisService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param cmisDictionaryService the cmisDictionaryService to set
|
||||
*/
|
||||
public void setCmisDictionaryService(CMISDictionaryService cmisDictionaryService)
|
||||
{
|
||||
this.cmisDictionaryService = cmisDictionaryService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param cmisMapping the cmisMapping to set
|
||||
*/
|
||||
public void setCmisMapping(CMISMapping cmisMapping)
|
||||
{
|
||||
this.cmisMapping = cmisMapping;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.alfresco.cmis.search.CMISQueryService#query(org.alfresco.cmis.search.CMISQueryOptions)
|
||||
*/
|
||||
public CMISResultSet query(CMISQueryOptions options)
|
||||
{
|
||||
CMISQueryParser parser = new CMISQueryParser(options, cmisDictionaryService, cmisMapping, getJoinSupport());
|
||||
Query query = parser.parse();
|
||||
System.out.println(query);
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.alfresco.cmis.search.CMISQueryService#query(java.lang.String)
|
||||
*/
|
||||
public CMISResultSet query(String query)
|
||||
{
|
||||
CMISQueryOptions options = new CMISQueryOptions(query, cmisService.getDefaultRootStoreRef());
|
||||
return query(options);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.cmis.search.CMISQueryService#getAllVersionsSearchable()
|
||||
*/
|
||||
public boolean getAllVersionsSearchable()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.cmis.search.CMISQueryService#getFullTextSearchSupport()
|
||||
*/
|
||||
public FullTextSearchSupport getFullTextSearchSupport()
|
||||
{
|
||||
return FullTextSearchSupport.FULL_TEXT_AND_STRUCTURED;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.cmis.search.CMISQueryService#getJoinSupport()
|
||||
*/
|
||||
public JoinSupport getJoinSupport()
|
||||
{
|
||||
return JoinSupport.NO_JOIN_SUPPORT;
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user