@Test public final void testPropertyPathMapper() { Map<String, String> propertyPathMapper = new HashMap<>(); propertyPathMapper.put("i", "id"); propertyPathMapper.put("ci", "company.id"); propertyPathMapper.put("n", "name"); propertyPathMapper.put("urir", "userRoles.id.roleId"); propertyPathMapper.put("urrc", "userRoles.role.code"); String rsql = "i==2"; List<User> users = (List<User>) userRepository.findAll(toPredicate(rsql, QUser.user, propertyPathMapper)); long count = users.size(); log.info("rsql: {} -> count: {}", rsql, count); assertThat(rsql, count, is(1l)); assertThat(rsql, users.get(0).getName(), equalTo("February")); rsql = "i=='2'"; List<Company> companys = (List<Company>) companyRepository.findAll(toPredicate(rsql, QCompany.company, propertyPathMapper)); count = companys.size(); log.info("rsql: {} -> count: {}", rsql, count); assertThat(rsql, count, is(1l)); assertThat(rsql, companys.get(0).getName(), equalTo("World Inc")); rsql = "ci=='2'"; users = (List<User>) userRepository.findAll(toPredicate(rsql, QUser.user, propertyPathMapper)); count = users.size(); log.info("rsql: {} -> count: {}", rsql, count); assertThat(rsql, count, is(4l)); assertThat(rsql, users.get(0).getName(), equalTo("March")); assertThat(rsql, users.get(1).getName(), equalTo("April")); assertThat(rsql, users.get(2).getName(), equalTo("May")); assertThat(rsql, users.get(3).getName(), equalTo("June")); assertThat(rsql, users.get(0).getCompany().getName(), equalTo("World Inc")); rsql = "n==''"; companys = (List<Company>) companyRepository.findAll(toPredicate(rsql, QCompany.company, propertyPathMapper)); count = companys.size(); log.info("rsql: {} -> count: {}", rsql, count); assertThat(rsql, count, is(1l)); assertThat(rsql, companys.get(0).getCode(), equalTo("empty")); assertThat(rsql, companys.get(0).getName(), equalTo("")); rsql = "urir=='2'"; users = (List<User>) userRepository.findAll(toPredicate(rsql, QUser.user, propertyPathMapper)); count = users.size(); log.info("rsql: {} -> count: {}", rsql, count); assertThat(rsql, count, is(3l)); rsql = "urrc=='admin'"; users = (List<User>) userRepository.findAll(toPredicate(rsql, QUser.user, propertyPathMapper)); count = users.size(); log.info("rsql: {} -> count: {}", rsql, count); assertThat(rsql, count, is(3l)); }
public static BooleanExpression toPredicate(final String rsqlQuery, final Path qClazz) { return toPredicate(rsqlQuery, qClazz, null); }
RSQLQueryDslSupport extends RSQLJPASupport { public static BooleanExpression toPredicate(final String rsqlQuery, final Path qClazz) { return toPredicate(rsqlQuery, qClazz, null); } }
RSQLQueryDslSupport extends RSQLJPASupport { public static BooleanExpression toPredicate(final String rsqlQuery, final Path qClazz) { return toPredicate(rsqlQuery, qClazz, null); } RSQLQueryDslSupport();  RSQLQueryDslSupport(Map<String, EntityManager> entityManagerMap); }
RSQLQueryDslSupport extends RSQLJPASupport { public static BooleanExpression toPredicate(final String rsqlQuery, final Path qClazz) { return toPredicate(rsqlQuery, qClazz, null); } RSQLQueryDslSupport();  RSQLQueryDslSupport(Map<String, EntityManager> entityManagerMap); static BooleanExpression toPredicate(final String rsqlQuery, final Path qClazz); static BooleanExpression toPredicate(final String rsqlQuery, final Path qClazz, final Map<String, String> propertyPathMapper); }
RSQLQueryDslSupport extends RSQLJPASupport { public static BooleanExpression toPredicate(final String rsqlQuery, final Path qClazz) { return toPredicate(rsqlQuery, qClazz, null); } RSQLQueryDslSupport();  RSQLQueryDslSupport(Map<String, EntityManager> entityManagerMap); static BooleanExpression toPredicate(final String rsqlQuery, final Path qClazz); static BooleanExpression toPredicate(final String rsqlQuery, final Path qClazz, final Map<String, String> propertyPathMapper);  }