Interface RsqlQueryTransformer

All Superinterfaces:
cz.jirutka.rsql.parser.ast.RSQLVisitor<cz.jirutka.rsql.parser.ast.Node,Class<?>>
All Known Implementing Classes:
FilterAndSortAliasRsqlQueryTransformer

public interface RsqlQueryTransformer extends cz.jirutka.rsql.parser.ast.RSQLVisitor<cz.jirutka.rsql.parser.ast.Node,Class<?>>

Allows customization of an RSQL query before it is passed on to the repository layer. Since the web layer adds filters against the business domain, this allows for swapping out these selectors for the repository-domain-specific selectors. Example:

 public ProductQueryTransformer implements RsqlQueryTransformer {
     
     public Node visit(ComparisonNode node, RsqlTransformRequest param) {
         if (JpaProduct.class.isAssignableFrom(param.getRepositoryDomainType())) {
             if (node.getSelector().equals("id")) {
                 return node.withSelector("contextId");
             }
         }
         return node;
     }
     
 }
 

RsqlQueryTransformers can be ordered and the result of each is passed to the next transformer in the line.

Author:
Phillip Verheyden (phillipuniverse)
  • Method Summary

    Modifier and Type
    Method
    Description
    default cz.jirutka.rsql.parser.ast.Node
    visit(cz.jirutka.rsql.parser.ast.AndNode node, Class<?> repositoryDomain)
     
    default cz.jirutka.rsql.parser.ast.Node
    visit(cz.jirutka.rsql.parser.ast.ComparisonNode node, Class<?> repositoryDomain)
     
    default cz.jirutka.rsql.parser.ast.Node
    visit(cz.jirutka.rsql.parser.ast.Node node, Class<?> repositoryDomain)
     
    default cz.jirutka.rsql.parser.ast.Node
    visit(cz.jirutka.rsql.parser.ast.OrNode node, Class<?> repositoryDomain)
     
  • Method Details

    • visit

      default cz.jirutka.rsql.parser.ast.Node visit(cz.jirutka.rsql.parser.ast.Node node, Class<?> repositoryDomain)
    • visit

      @NonNull default cz.jirutka.rsql.parser.ast.Node visit(cz.jirutka.rsql.parser.ast.AndNode node, Class<?> repositoryDomain)
      Specified by:
      visit in interface cz.jirutka.rsql.parser.ast.RSQLVisitor<cz.jirutka.rsql.parser.ast.Node,Class<?>>
    • visit

      @NonNull default cz.jirutka.rsql.parser.ast.Node visit(cz.jirutka.rsql.parser.ast.OrNode node, Class<?> repositoryDomain)
      Specified by:
      visit in interface cz.jirutka.rsql.parser.ast.RSQLVisitor<cz.jirutka.rsql.parser.ast.Node,Class<?>>
    • visit

      @NonNull default cz.jirutka.rsql.parser.ast.Node visit(cz.jirutka.rsql.parser.ast.ComparisonNode node, Class<?> repositoryDomain)
      Specified by:
      visit in interface cz.jirutka.rsql.parser.ast.RSQLVisitor<cz.jirutka.rsql.parser.ast.Node,Class<?>>