org.alfresco.repo.search.impl.querymodel.Order Java Examples

The following examples show how to use org.alfresco.repo.search.impl.querymodel.Order. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LuceneQuery.java    From alfresco-data-model with GNU Lesser General Public License v3.0 5 votes vote down vote up
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;
}
 
Example #2
Source File: DBOrdering.java    From alfresco-repository with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 * @param column Column
 * @param order Order
 */
public DBOrdering(Column column, Order order)
{
    super(column, order);
}
 
Example #3
Source File: DBQueryModelFactory.java    From alfresco-repository with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public Ordering createOrdering(Column column, Order order)
{
    return new DBOrdering(column, order);
}
 
Example #4
Source File: BaseOrdering.java    From alfresco-data-model with GNU Lesser General Public License v3.0 4 votes vote down vote up
public BaseOrdering(Column column, Order order)
{
    this.column = column;
    this.order = order;
}
 
Example #5
Source File: BaseOrdering.java    From alfresco-data-model with GNU Lesser General Public License v3.0 4 votes vote down vote up
public Order getOrder()
{
   return order;
}
 
Example #6
Source File: LuceneOrdering.java    From alfresco-data-model with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 * @param column Column
 * @param order Order
 */
public LuceneOrdering(Column column, Order order)
{
    super(column, order);
    // TODO Auto-generated constructor stub
}
 
Example #7
Source File: LuceneQueryModelFactory.java    From alfresco-data-model with GNU Lesser General Public License v3.0 4 votes vote down vote up
public Ordering createOrdering(Column column, Order order)
{
    return new LuceneOrdering(column, order);
}