use of ru.ydn.wicket.wicketorientdb.utils.query.filter.FilterCriteriaManager in project wicket-orientdb by OrienteerBAP.
the class TestFilters method testContainsTextFilterCriteria.
@Test
public void testContainsTextFilterCriteria() {
IModel<OProperty> property = wicket.getProperty(STRING_FIELD);
IFilterCriteriaManager manager = new FilterCriteriaManager(property);
IModel<String> model = Model.of("summer");
manager.addFilterCriteria(manager.createContainsStringFilterCriteria(model, Model.of(true)));
queryModel.addFilterCriteriaManager(property.getObject().getName(), manager);
assertTrue(queryModel.size() == 1);
assertTrue(queryModel.getObject().get(0).field(STRING_FIELD).equals(STR_VALUE_2));
}
use of ru.ydn.wicket.wicketorientdb.utils.query.filter.FilterCriteriaManager in project wicket-orientdb by OrienteerBAP.
the class TestFilters method testEqualsToDateTimeFilterCriteria.
@Test
public void testEqualsToDateTimeFilterCriteria() throws ParseException {
IModel<OProperty> property = wicket.getProperty(DATETIME_FIELD);
IFilterCriteriaManager manager = new FilterCriteriaManager(property);
IModel<String> model = Model.of(DATETIME_VALUE_1);
manager.addFilterCriteria(manager.createEqualsFilterCriteria(model, Model.of(true)));
queryModel.addFilterCriteriaManager(property.getObject().getName(), manager);
assertTrue(queryModel.size() == 1);
queryModel.clearFilterCriteriaManagers();
queryModel.detach();
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
IModel<Date> dateModel = Model.of(dateFormat.parse(DATETIME_VALUE_1));
manager.addFilterCriteria(manager.createEqualsFilterCriteria(dateModel, Model.of(true)));
queryModel.addFilterCriteriaManager(property.getObject().getName(), manager);
assertTrue(queryModel.size() == 1);
}
use of ru.ydn.wicket.wicketorientdb.utils.query.filter.FilterCriteriaManager in project wicket-orientdb by OrienteerBAP.
the class TestFilters method testEmbeddedContainsValueFilter.
@Test
public void testEmbeddedContainsValueFilter() {
IFilterCriteriaManager manager = new FilterCriteriaManager(wicket.getProperty(EMBEDDED_FIELD));
IFilterCriteria criteria = manager.createEmbeddedContainsValueCriteria(Model.of(STR_VALUE_2), Model.of(true));
manager.addFilterCriteria(criteria);
queryModel.addFilterCriteriaManager(EMBEDDED_FIELD, manager);
assertTrue("size must be 1, but it is - " + queryModel.size(), queryModel.size() == 1);
}
use of ru.ydn.wicket.wicketorientdb.utils.query.filter.FilterCriteriaManager in project wicket-orientdb by OrienteerBAP.
the class TestFilters method testRangeFilterCriteriaFirstNull.
@Test
public void testRangeFilterCriteriaFirstNull() {
List<Integer> models = Lists.newArrayList();
models.add(null);
models.add(NUM_VALUE_2);
IModel<List<Integer>> listModel = new ListModel<>(models);
IFilterCriteriaManager manager = new FilterCriteriaManager(wicket.getProperty(NUMBER_FIELD));
manager.addFilterCriteria(manager.createRangeFilterCriteria(listModel, Model.of(true)));
String field = wicket.getProperty(NUMBER_FIELD).getObject().getName();
queryModel.addFilterCriteriaManager(field, manager);
queryModel.setSort(NUMBER_FIELD, SortOrder.ASCENDING);
assertTrue("size must be 2, but it is - " + queryModel.size(), queryModel.size() == 2);
}
use of ru.ydn.wicket.wicketorientdb.utils.query.filter.FilterCriteriaManager in project wicket-orientdb by OrienteerBAP.
the class TestFilters method testODocumentLinkQueryProvider.
@Test
public void testODocumentLinkQueryProvider() {
IFilterCriteriaManager manager = new FilterCriteriaManager(wicket.getProperty(NUMBER_FIELD));
IFilterCriteria equalsFilterCriteria = manager.createEqualsFilterCriteria(Model.of(NUM_VALUE_1), Model.of(true));
manager.addFilterCriteria(equalsFilterCriteria);
String numField = wicket.getProperty(NUMBER_FIELD).getObject().getName();
queryModel.addFilterCriteriaManager(numField, manager);
ODocument doc = queryModel.getObject().get(0);
IModel<OProperty> property = wicket.getProperty(LINK_LIST_FIELD);
ODocumentLinksQueryDataProvider provider = new ODocumentLinksQueryDataProvider(new ODocumentModel(doc), property);
OQueryModel<ODocument> state = provider.getFilterState();
state.addFilterCriteriaManager(numField, manager);
state.detach();
assertTrue("size must be 1, but it is " + provider.size(), provider.size() == 1);
assertTrue(state.getObject().get(0) != null);
}
Aggregations