Search in sources :

Example 1 with EmptySortInfo

use of org.jboss.pnc.datastore.limits.rsql.EmptySortInfo in project pnc by project-ncl.

the class RSQLProducerImpl method getSortInfo.

@Override
public <DB extends GenericEntity<?>> SortInfo getSortInfo(Class<DB> type, String rsql) {
    if (rsql == null || rsql.isEmpty()) {
        return new EmptySortInfo();
    }
    if (!rsql.startsWith(FIXED_START_OF_SORTING_EXPRESSION)) {
        rsql = FIXED_START_OF_SORTING_EXPRESSION + rsql;
    }
    Node rootNode = sortParser.parse(preprocessRSQL(rsql));
    Function<RSQLSelectorPath, String> toPath = (RSQLSelectorPath selector) -> mapper.toPath(type, selector);
    return (SortInfo) rootNode.accept(new SortRSQLNodeTraveller(toPath));
}
Also used : Node(cz.jirutka.rsql.parser.ast.Node) EmptySortInfo(org.jboss.pnc.datastore.limits.rsql.EmptySortInfo) SortInfo(org.jboss.pnc.spi.datastore.repositories.api.SortInfo) EmptySortInfo(org.jboss.pnc.datastore.limits.rsql.EmptySortInfo)

Aggregations

Node (cz.jirutka.rsql.parser.ast.Node)1 EmptySortInfo (org.jboss.pnc.datastore.limits.rsql.EmptySortInfo)1 SortInfo (org.jboss.pnc.spi.datastore.repositories.api.SortInfo)1