当前位置: 首页>>代码示例>>Java>>正文


Java Ordering类代码示例

本文整理汇总了Java中org.alfresco.repo.search.impl.querymodel.Ordering的典型用法代码示例。如果您正苦于以下问题:Java Ordering类的具体用法?Java Ordering怎么用?Java Ordering使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Ordering类属于org.alfresco.repo.search.impl.querymodel包,在下文中一共展示了Ordering类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: BaseQuery

import org.alfresco.repo.search.impl.querymodel.Ordering; //导入依赖的package包/类
public BaseQuery(List<Column> columns, Source source, Constraint constraint, List<Ordering> orderings)
{
    this.columns = columns;
    this.source = source;
    this.constraint = constraint;
    this.orderings = orderings;
}
 
开发者ID:Alfresco,项目名称:alfresco-data-model,代码行数:8,代码来源:BaseQuery.java

示例2: buildSortDefinitions

import org.alfresco.repo.search.impl.querymodel.Ordering; //导入依赖的package包/类
public List<SortDefinition> buildSortDefinitions(Set<String> selectors, LuceneQueryBuilderContext<Q, S, E> luceneContext, FunctionEvaluationContext functionContext)
{
    if ((getOrderings() == null) || (getOrderings().size() == 0))
    {
        return Collections.<SortDefinition>emptyList();
    }

    ArrayList<SortDefinition> definitions = new ArrayList<SortDefinition>(getOrderings().size());

    for (Ordering ordering : getOrderings())
    {
        if (ordering.getColumn().getFunction().getName().equals(PropertyAccessor.NAME))
        {
            PropertyArgument property = (PropertyArgument) ordering.getColumn().getFunctionArguments().get(PropertyAccessor.ARG_PROPERTY);

            if (property == null)
            {
                throw new IllegalStateException();
            }

            String propertyName = property.getPropertyName();

            String fieldName = functionContext.getLuceneFieldName(propertyName);
            
            definitions.add(new SortDefinition(SortType.FIELD, fieldName, ordering.getOrder() == Order.ASCENDING));
        }
        else if (ordering.getColumn().getFunction().getName().equals(Score.NAME))
        {
            definitions.add(new SortDefinition(SortType.SCORE, null, ordering.getOrder() == Order.ASCENDING));
        }
    }

    return definitions;
}
 
开发者ID:Alfresco,项目名称:alfresco-data-model,代码行数:35,代码来源:LuceneQuery.java

示例3: DBQuery

import org.alfresco.repo.search.impl.querymodel.Ordering; //导入依赖的package包/类
/**
 * @param source Source
 * @param constraint Constraint
 */
public DBQuery(List<Column> columns, Source source, Constraint constraint, List<Ordering> orderings)
{
    super(columns, source, constraint, orderings);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:9,代码来源:DBQuery.java

示例4: prepare

import org.alfresco.repo.search.impl.querymodel.Ordering; //导入依赖的package包/类
@Override
public void prepare(NamespaceService namespaceService, DictionaryService dictionaryService, QNameDAO qnameDAO, NodeDAO nodeDAO, TenantService tenantService, Set<String> selectors,
        Map<String, Argument> functionArgs, FunctionEvaluationContext functionContext, boolean supportBooleanFloatAndDouble)
{
    selectorGroup = selectors;
    if (selectorGroup != null)
    {
        for (String selector : selectorGroup)
        {
            Selector current = getSource().getSelector(selector);
            if (current instanceof DBQueryBuilderComponent)
            {
                ((DBQueryBuilderComponent) current).prepare(namespaceService, dictionaryService, qnameDAO, nodeDAO, tenantService, selectorGroup, functionArgs, functionContext, supportBooleanFloatAndDouble);
            }
            else
            {
                throw new UnsupportedOperationException();
            }
        }
    }

    if (getConstraint() != null)
    {
        if (getConstraint() instanceof DBQueryBuilderComponent)
        {
            ((DBQueryBuilderComponent) getConstraint()).prepare(namespaceService, dictionaryService, qnameDAO, nodeDAO, tenantService, selectorGroup, functionArgs, functionContext, supportBooleanFloatAndDouble);
        }
        else
        {
            throw new UnsupportedOperationException();
        }
    }
    
    if(getOrderings() != null)
    {
        for(Ordering ordering : getOrderings())
        {
            if(ordering instanceof DBQueryBuilderComponent)
            {
                ((DBQueryBuilderComponent) ordering).prepare(namespaceService, dictionaryService, qnameDAO, nodeDAO, tenantService, selectorGroup, functionArgs, functionContext, supportBooleanFloatAndDouble);
            }
            else
            {
                throw new UnsupportedOperationException();
            }
        }
    }

}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:50,代码来源:DBQuery.java

示例5: buildJoins

import org.alfresco.repo.search.impl.querymodel.Ordering; //导入依赖的package包/类
@Override
public void buildJoins(Map<QName, DBQueryBuilderJoinCommand> singleJoins, List<DBQueryBuilderJoinCommand> multiJoins)
{
    if (selectorGroup != null)
    {
        for (String selector : selectorGroup)
        {
            Selector current = getSource().getSelector(selector);
            if (current instanceof DBQueryBuilderComponent)
            {
                ((DBQueryBuilderComponent) current).buildJoins(singleJoins, multiJoins);
            }
            else
            {
                throw new UnsupportedOperationException();
            }
        }
    }

    if (getConstraint() != null)
    {
        if (getConstraint() instanceof DBQueryBuilderComponent)
        {
            ((DBQueryBuilderComponent) getConstraint()).buildJoins(singleJoins, multiJoins);
        }
        else
        {
            throw new UnsupportedOperationException();
        }
    }
    if(getOrderings() != null)
    {
        for(Ordering ordering : getOrderings())
        {
            if(ordering instanceof DBQueryBuilderComponent)
            {
                ((DBQueryBuilderComponent) ordering).buildJoins(singleJoins, multiJoins);
            }
            else
            {
                throw new UnsupportedOperationException();
            }
        }
    }

}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:47,代码来源:DBQuery.java

示例6: createQuery

import org.alfresco.repo.search.impl.querymodel.Ordering; //导入依赖的package包/类
@Override
public Query createQuery(List<Column> columns, Source source, Constraint constraint, List<Ordering> orderings)
{
    return new DBQuery(columns, source, constraint, orderings);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:6,代码来源:DBQueryModelFactory.java

示例7: createOrdering

import org.alfresco.repo.search.impl.querymodel.Ordering; //导入依赖的package包/类
@Override
public Ordering createOrdering(Column column, Order order)
{
    return new DBOrdering(column, order);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:6,代码来源:DBQueryModelFactory.java

示例8: getOrderings

import org.alfresco.repo.search.impl.querymodel.Ordering; //导入依赖的package包/类
public List<Ordering> getOrderings()
{
    return orderings;
}
 
开发者ID:Alfresco,项目名称:alfresco-data-model,代码行数:5,代码来源:BaseQuery.java

示例9: LuceneQuery

import org.alfresco.repo.search.impl.querymodel.Ordering; //导入依赖的package包/类
/**
 * @param source Source
 * @param constraint Constraint
 */
public LuceneQuery(List<Column> columns, Source source, Constraint constraint, List<Ordering> orderings)
{
    super(columns, source, constraint, orderings);
}
 
开发者ID:Alfresco,项目名称:alfresco-data-model,代码行数:9,代码来源:LuceneQuery.java

示例10: createOrdering

import org.alfresco.repo.search.impl.querymodel.Ordering; //导入依赖的package包/类
public Ordering createOrdering(Column column, Order order)
{
    return new LuceneOrdering(column, order);
}
 
开发者ID:Alfresco,项目名称:alfresco-data-model,代码行数:5,代码来源:LuceneQueryModelFactory.java

示例11: createQuery

import org.alfresco.repo.search.impl.querymodel.Ordering; //导入依赖的package包/类
public Query createQuery(List<Column> columns, Source source, Constraint constraint, List<Ordering> orderings)
{
    return new LuceneQuery<Q, S, E>(columns, source, constraint, orderings);
}
 
开发者ID:Alfresco,项目名称:alfresco-data-model,代码行数:5,代码来源:LuceneQueryModelFactory.java

示例12: getFTSQuery

import org.alfresco.repo.search.impl.querymodel.Ordering; //导入依赖的package包/类
/**
* @param req SolrQueryRequest
* @return Query
* @throws ParseException
*/
public Query getFTSQuery(Pair<SearchParameters, Boolean> searchParametersAndFilter, SolrQueryRequest req, FTSQueryParser.RerankPhase rerankPhase) throws ParseException
{

    SearchParameters searchParameters = searchParametersAndFilter.getFirst();
    Boolean isFilter = searchParametersAndFilter.getSecond();

    QueryModelFactory factory = new LuceneQueryModelFactory<Query, Sort, SyntaxError>();
    AlfrescoFunctionEvaluationContext functionContext = new AlfrescoSolr4FunctionEvaluationContext(namespaceDAO, getDictionaryService(CMISStrictDictionaryService.DEFAULT), NamespaceService.CONTENT_MODEL_1_0_URI, req.getSchema());

    FTSParser.Mode mode;

    if (searchParameters.getDefaultFTSOperator() == org.alfresco.service.cmr.search.SearchParameters.Operator.AND)
    {
        mode = FTSParser.Mode.DEFAULT_CONJUNCTION;
    }
    else
    {
        mode = FTSParser.Mode.DEFAULT_DISJUNCTION;
    }

    Constraint constraint = FTSQueryParser.buildFTS(searchParameters.getQuery(), factory, functionContext, null, null, mode,
            searchParameters.getDefaultFTSOperator() == org.alfresco.service.cmr.search.SearchParameters.Operator.OR ? Connective.OR : Connective.AND,
                    searchParameters.getQueryTemplates(), searchParameters.getDefaultFieldName(), rerankPhase);
    org.alfresco.repo.search.impl.querymodel.Query queryModelQuery = factory.createQuery(null, null, constraint, new ArrayList<Ordering>());

    @SuppressWarnings("unchecked")
    LuceneQueryBuilder<Query, Sort, ParseException> builder = (LuceneQueryBuilder<Query, Sort, ParseException>) queryModelQuery;

    LuceneQueryBuilderContext<Query, Sort, ParseException> luceneContext = getLuceneQueryBuilderContext(searchParameters, req, CMISStrictDictionaryService.DEFAULT, rerankPhase);

    Set<String> selectorGroup = null;
    if (queryModelQuery.getSource() != null)
    {
        List<Set<String>> selectorGroups = queryModelQuery.getSource().getSelectorGroups(functionContext);

        if (selectorGroups.size() == 0)
        {
            throw new UnsupportedOperationException("No selectors");
        }

        if (selectorGroups.size() > 1)
        {
            throw new UnsupportedOperationException("Advanced join is not supported");
        }

        selectorGroup = selectorGroups.get(0);
    }
    Query luceneQuery = builder.buildQuery(selectorGroup, luceneContext, functionContext);
    // query needs some search parameters fro correct caching ....

    ContextAwareQuery contextAwareQuery = new ContextAwareQuery(luceneQuery, Boolean.TRUE.equals(isFilter) ? null : searchParameters);
    return contextAwareQuery;
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:59,代码来源:AlfrescoSolrDataModel.java

示例13: buildSort

import org.alfresco.repo.search.impl.querymodel.Ordering; //导入依赖的package包/类
@Override
public Sort buildSort(List<Ordering> list, FunctionEvaluationContext functionContext) throws ParseException
{
    throw new UnsupportedOperationException();
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:6,代码来源:Lucene4QueryParserAdaptor.java

示例14: buildSort

import org.alfresco.repo.search.impl.querymodel.Ordering; //导入依赖的package包/类
@Override
public Sort buildSort(List<Ordering> orderings, FunctionEvaluationContext functionContext) throws ParseException
{
    int index = 0;
    SortField[] fields = new SortField[orderings.size()];

    for (Ordering ordering : orderings)
    {
        if (ordering.getColumn().getFunction().getName().equals(PropertyAccessor.NAME))
        {
            PropertyArgument property = (PropertyArgument) ordering.getColumn().getFunctionArguments().get(PropertyAccessor.ARG_PROPERTY);

            if (property == null)
            {
                throw new IllegalStateException();
            }

            String propertyName = property.getPropertyName();

            String luceneField = functionContext.getLuceneSortField(this, propertyName);

            if (luceneField != null)
            {
                if (LuceneUtils.fieldHasTerm(lqp.getIndexReader(), luceneField))
                {
                    Locale locale = this.getSearchParameters().getSortLocale();
                    fields[index++] = new SortField(luceneField, locale, (ordering.getOrder() == Order.DESCENDING));
                }
                else
                {
                    fields[index++] = new SortField(null, SortField.DOC, (ordering.getOrder() == Order.DESCENDING));
                }
            }
            else
            {
                throw new IllegalStateException();
            }
        }
        else if (ordering.getColumn().getFunction().getName().equals(Score.NAME))
        {
            fields[index++] = new SortField(null, SortField.SCORE, !(ordering.getOrder() == Order.DESCENDING));
        }
        else
        {
            throw new IllegalStateException();
        }

    }

    return new Sort(fields);
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:52,代码来源:LegacyLuceneQueryParserAdaptor.java

示例15: getFTSQuery

import org.alfresco.repo.search.impl.querymodel.Ordering; //导入依赖的package包/类
public Query getFTSQuery(Pair<SearchParameters, Boolean> searchParametersAndFilter, IndexReader indexReader) throws ParseException
{
    SearchParameters searchParameters = searchParametersAndFilter.getFirst();
    Boolean isFilter = searchParametersAndFilter.getSecond();
    
    QueryModelFactory factory = new LuceneQueryModelFactory();
    AlfrescoFunctionEvaluationContext functionContext = new AlfrescoFunctionEvaluationContext(namespaceDAO, getDictionaryService(CMISStrictDictionaryService.DEFAULT), NamespaceService.CONTENT_MODEL_1_0_URI);

    FTSParser.Mode mode;

    if (searchParameters.getDefaultFTSOperator() == org.alfresco.service.cmr.search.SearchParameters.Operator.AND)
    {
        mode = FTSParser.Mode.DEFAULT_CONJUNCTION;
    }
    else
    {
        mode = FTSParser.Mode.DEFAULT_DISJUNCTION;
    }

    Constraint constraint = FTSQueryParser.buildFTS(searchParameters.getQuery(), factory, functionContext, null, null, mode,
            searchParameters.getDefaultFTSOperator() == org.alfresco.service.cmr.search.SearchParameters.Operator.OR ? Connective.OR : Connective.AND,
            searchParameters.getQueryTemplates(), searchParameters.getDefaultFieldName(), FTSQueryParser.RerankPhase.SINGLE_PASS);
    org.alfresco.repo.search.impl.querymodel.Query queryModelQuery = factory.createQuery(null, null, constraint, new ArrayList<Ordering>());

    @SuppressWarnings("unchecked")
    LuceneQueryBuilder<Query, Sort, ParseException> builder = (LuceneQueryBuilder<Query, Sort, ParseException>) queryModelQuery;

    LuceneQueryBuilderContext<Query, Sort, ParseException> luceneContext = getLuceneQueryBuilderContext(searchParameters, indexReader, CMISStrictDictionaryService.DEFAULT);

    Set<String> selectorGroup = null;
    if (queryModelQuery.getSource() != null)
    {
        List<Set<String>> selectorGroups = queryModelQuery.getSource().getSelectorGroups(functionContext);

        if (selectorGroups.size() == 0)
        {
            throw new UnsupportedOperationException("No selectors");
        }

        if (selectorGroups.size() > 1)
        {
            throw new UnsupportedOperationException("Advanced join is not supported");
        }

        selectorGroup = selectorGroups.get(0);
    }
    Query luceneQuery = builder.buildQuery(selectorGroup, luceneContext, functionContext);
    // query needs some search parameters fro correct caching ....

    ContextAwareQuery contextAwareQuery = new ContextAwareQuery(luceneQuery, Boolean.TRUE.equals(isFilter) ? null : searchParameters);
    return contextAwareQuery;
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:53,代码来源:AlfrescoSolrDataModel.java


注:本文中的org.alfresco.repo.search.impl.querymodel.Ordering类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。