本文整理汇总了Java中org.alfresco.service.cmr.search.SearchParameters.getQueryParameterDefinitions方法的典型用法代码示例。如果您正苦于以下问题:Java SearchParameters.getQueryParameterDefinitions方法的具体用法?Java SearchParameters.getQueryParameterDefinitions怎么用?Java SearchParameters.getQueryParameterDefinitions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.alfresco.service.cmr.search.SearchParameters
的用法示例。
在下文中一共展示了SearchParameters.getQueryParameterDefinitions方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: query
import org.alfresco.service.cmr.search.SearchParameters; //导入方法依赖的package包/类
public ResultSet query(SearchParameters searchParameters)
{
if (searchParameters.getStores().size() != 1)
{
throw new IllegalStateException("Only one store can be searched at present");
}
ArrayList<StoreRef> stores = searchParameters.getStores();
stores.set(0, tenantService.getName(searchParameters.getStores().get(0)));
String parameterisedQueryString;
if (searchParameters.getQueryParameterDefinitions().size() > 0)
{
Map<QName, QueryParameterDefinition> map = new HashMap<QName, QueryParameterDefinition>();
for (QueryParameterDefinition qpd : searchParameters.getQueryParameterDefinitions())
{
map.put(qpd.getQName(), qpd);
}
parameterisedQueryString = parameterise(searchParameters.getQuery(), map, null, namespacePrefixResolver);
}
else
{
parameterisedQueryString = searchParameters.getQuery();
}
// TODO: add another property so the set query is not changed ...
// May be good to return the query as run ??
searchParameters.setQuery(parameterisedQueryString);
LuceneQueryLanguageSPI language = queryLanguages.get(searchParameters.getLanguage().toLowerCase());
if (language != null)
{
return language.executeQuery(searchParameters, this);
}
else
{
throw new SearcherException("Unknown query language: " + searchParameters.getLanguage());
}
}
示例2: query
import org.alfresco.service.cmr.search.SearchParameters; //导入方法依赖的package包/类
@Override
public ResultSet query(SearchParameters searchParameters)
{
if(searchParameters.getStores().size() == 0)
{
throw new IllegalStateException("At least one store must be defined to search");
}
String parameterisedQueryString;
if (searchParameters.getQueryParameterDefinitions().size() > 0)
{
Map<QName, QueryParameterDefinition> map = new HashMap<QName, QueryParameterDefinition>();
for (QueryParameterDefinition qpd : searchParameters.getQueryParameterDefinitions())
{
map.put(qpd.getQName(), qpd);
}
parameterisedQueryString = parameterise(searchParameters.getQuery(), map, null, namespacePrefixResolver);
}
else
{
parameterisedQueryString = searchParameters.getQuery();
}
// TODO: add another property so the set query is not changed ...
// May be good to return the query as run ??
searchParameters.setQuery(parameterisedQueryString);
LuceneQueryLanguageSPI language = queryLanguages.get(searchParameters.getLanguage().toLowerCase());
if (language != null)
{
return language.executeQuery(searchParameters, null);
}
else
{
throw new SearcherException("Unknown query language: " + searchParameters.getLanguage());
}
}