use of cz.jirutka.rsql.parser.RSQLParser in project molgenis by molgenis.
the class RestConfig method rsqlParser.
@Bean
public RSQLParser rsqlParser() {
Set<ComparisonOperator> operators = RSQLOperators.defaultOperators();
operators.add(new ComparisonOperator("=q=", false));
operators.add(new ComparisonOperator("=notlike=", false));
operators.add(new ComparisonOperator("=rng=", true));
operators.add(new ComparisonOperator("=like=", false));
return new RSQLParser(operators);
}
use of cz.jirutka.rsql.parser.RSQLParser in project tutorials by eugenp.
the class UserController method findAllByRsql.
@RequestMapping(method = RequestMethod.GET, value = "/users/rsql")
@ResponseBody
public List<User> findAllByRsql(@RequestParam(value = "search") String search) {
Node rootNode = new RSQLParser().parse(search);
Specification<User> spec = rootNode.accept(new CustomRsqlVisitor<User>());
return dao.findAll(spec);
}
use of cz.jirutka.rsql.parser.RSQLParser in project tutorials by eugenp.
the class RsqlIntegrationTest method givenFirstNameInverse_whenGettingListOfUsers_thenCorrect.
@Test
public void givenFirstNameInverse_whenGettingListOfUsers_thenCorrect() {
final Node rootNode = new RSQLParser().parse("firstName!=john");
final Specification<User> spec = rootNode.accept(new CustomRsqlVisitor<User>());
final List<User> results = repository.findAll(spec);
assertThat(userTom, isIn(results));
assertThat(userJohn, not(isIn(results)));
}
use of cz.jirutka.rsql.parser.RSQLParser in project tutorials by eugenp.
the class RsqlIntegrationTest method givenListOfFirstName_whenGettingListOfUsers_thenCorrect.
@Test
public void givenListOfFirstName_whenGettingListOfUsers_thenCorrect() {
final Node rootNode = new RSQLParser().parse("firstName=in=(john,jack)");
final Specification<User> spec = rootNode.accept(new CustomRsqlVisitor<User>());
final List<User> results = repository.findAll(spec);
assertThat(userJohn, isIn(results));
assertThat(userTom, not(isIn(results)));
}
use of cz.jirutka.rsql.parser.RSQLParser in project tutorials by eugenp.
the class RsqlIntegrationTest method givenMinAge_whenGettingListOfUsers_thenCorrect.
@Test
public void givenMinAge_whenGettingListOfUsers_thenCorrect() {
final Node rootNode = new RSQLParser().parse("age>25");
final Specification<User> spec = rootNode.accept(new CustomRsqlVisitor<User>());
final List<User> results = repository.findAll(spec);
assertThat(userTom, isIn(results));
assertThat(userJohn, not(isIn(results)));
}
Aggregations