use of com.github.tfaga.lynx.beans.QueryFilter in project lynx by TFaga.
the class JPAUtilsFiltersTest method testManyToOneRelationOnlyField.
@Test
public void testManyToOneRelationOnlyField() {
QueryFilter qf = new QueryFilter();
qf.setField("user");
qf.setOperation(FilterOperation.EQ);
qf.setValue("28");
QueryParameters q = new QueryParameters();
q.getFilters().add(qf);
List<Project> projects = JPAUtils.queryEntities(em, Project.class, q);
Assert.assertNotNull(projects);
Assert.assertEquals(100, projects.size());
}
use of com.github.tfaga.lynx.beans.QueryFilter in project lynx by TFaga.
the class JPAUtilsFiltersTest method testEnumInFilter.
@Test
public void testEnumInFilter() {
QueryFilter qf = new QueryFilter();
qf.setField("status");
qf.setOperation(FilterOperation.IN);
qf.getValues().add("ACTIVE");
QueryParameters q = new QueryParameters();
q.getFilters().add(qf);
List<Project> projects = JPAUtils.queryEntities(em, Project.class, q);
Assert.assertNotNull(projects);
Assert.assertEquals(50, projects.size());
}
use of com.github.tfaga.lynx.beans.QueryFilter in project lynx by TFaga.
the class JPAUtilsFiltersTest method testEnumNinFilter.
@Test
public void testEnumNinFilter() {
QueryFilter qf = new QueryFilter();
qf.setField("status");
qf.setOperation(FilterOperation.NIN);
qf.getValues().add("ACTIVE");
qf.getValues().add("INACTIVE");
QueryParameters q = new QueryParameters();
q.getFilters().add(qf);
List<Project> projects = JPAUtils.queryEntities(em, Project.class, q);
Assert.assertNotNull(projects);
Assert.assertEquals(0, projects.size());
}
use of com.github.tfaga.lynx.beans.QueryFilter in project lynx by TFaga.
the class JPAUtilsFiltersTest method testOneToManyRelationOnlyFieldInteger.
@Test
public void testOneToManyRelationOnlyFieldInteger() {
QueryFilter qf = new QueryFilter();
qf.setField("projects");
qf.setOperation(FilterOperation.EQ);
qf.setValue("28");
QueryParameters q = new QueryParameters();
q.getFilters().add(qf);
List<User> users = JPAUtils.queryEntities(em, User.class, q);
Assert.assertNotNull(users);
Assert.assertEquals(60, users.size());
}
use of com.github.tfaga.lynx.beans.QueryFilter in project lynx by TFaga.
the class JPAUtilsFiltersTest method testWrongDateField.
@Test
public void testWrongDateField() {
Date d = Date.from(ZonedDateTime.parse("2014-11-26T11:15:08Z").toInstant());
QueryFilter qf = new QueryFilter();
qf.setField("lastname");
qf.setOperation(FilterOperation.LTE);
qf.setDateValue(d);
QueryParameters q = new QueryParameters();
q.getFilters().add(qf);
List<User> users = JPAUtils.queryEntities(em, User.class, q);
Assert.assertNotNull(users);
Assert.assertEquals(100, users.size());
}
Aggregations