use of ru.ydn.wicket.wicketorientdb.utils.query.filter.IFilterCriteriaManager in project wicket-orientdb by OrienteerBAP.
the class TestFilters method testEqualsToDateFilterCriteria.
@Test
public void testEqualsToDateFilterCriteria() throws ParseException {
IModel<OProperty> property = wicket.getProperty(DATE_FIELD);
IFilterCriteriaManager manager = new FilterCriteriaManager(property);
IModel<String> model = Model.of(DATE_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");
IModel<Date> dateModel = Model.of(dateFormat.parse(DATE_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.IFilterCriteriaManager in project wicket-orientdb by OrienteerBAP.
the class TestFilters method testEmbeddedSetFilter.
@Test
public void testEmbeddedSetFilter() {
IFilterCriteriaManager manager = new FilterCriteriaManager(wicket.getProperty(EMBEDDED_SET_FIELD));
List<String> list = new ArrayList<>();
list.add(STR_VALUE_2);
IModel<Collection<String>> model = new CollectionModel<String>(list);
IFilterCriteria criteria = manager.createEmbeddedCollectionCriteria(Model.of(STRING_FIELD), model, Model.of(true));
manager.addFilterCriteria(criteria);
queryModel.addFilterCriteriaManager(EMBEDDED_SET_FIELD, manager);
assertTrue("size must be more than 0, but it is - " + queryModel.size(), queryModel.size() > 0);
}
use of ru.ydn.wicket.wicketorientdb.utils.query.filter.IFilterCriteriaManager in project wicket-orientdb by OrienteerBAP.
the class TestFilters method testNewManager.
private void testNewManager(IModel<OProperty> property) {
IFilterCriteriaManager manager = new FilterCriteriaManager(property);
manager.addFilterCriteria(manager.createEqualsFilterCriteria(Model.of(), Model.<Boolean>of(true)));
queryModel.addFilterCriteriaManager(property.getObject().getName(), manager);
assertTrue(queryModel.size() == 4);
queryModel.detach();
queryModel.clearFilterCriteriaManagers();
}
use of ru.ydn.wicket.wicketorientdb.utils.query.filter.IFilterCriteriaManager in project wicket-orientdb by OrienteerBAP.
the class TestFilters method testEmbeddedListContainsValueFilter.
@Test
public void testEmbeddedListContainsValueFilter() {
IFilterCriteriaManager manager = new FilterCriteriaManager(wicket.getProperty(EMBEDDED_LIST_STRING_FIELD));
IFilterCriteria criteria = manager.createEmbeddedCollectionContainsValueCriteria(Model.of(STR_VALUE_1), Model.of(true));
manager.addFilterCriteria(criteria);
queryModel.addFilterCriteriaManager(EMBEDDED_LIST_STRING_FIELD, manager);
assertTrue("size must 1, but it is - " + queryModel.size(), queryModel.size() == 1);
}
use of ru.ydn.wicket.wicketorientdb.utils.query.filter.IFilterCriteriaManager in project wicket-orientdb by OrienteerBAP.
the class TestFilters method testLinkMapKey.
@Test
public void testLinkMapKey() {
String key = MAP_KEYS.get(0);
IModel<OProperty> property = wicket.getProperty(LINK_MAP_FIELD);
IFilterCriteriaManager manager = new FilterCriteriaManager(property);
manager.addFilterCriteria(manager.createMapContainsKeyCriteria(Model.of(key), Model.<Boolean>of(true)));
queryModel.addFilterCriteriaManager(LINK_MAP_FIELD, manager);
assertTrue("size must be 1 but it is - " + queryModel.getObject().size(), queryModel.getObject().size() == 1);
}
Aggregations