use of ru.ydn.wicket.wicketorientdb.utils.query.filter.IFilterCriteriaManager in project wicket-orientdb by OrienteerBAP.
the class TestFilters method testEmbeddedMapKey.
@Test
public void testEmbeddedMapKey() {
String key = MAP_KEYS.get(0);
IModel<OProperty> property = wicket.getProperty(EMBEDDED_MAP_FIELD);
IFilterCriteriaManager manager = new FilterCriteriaManager(property);
manager.addFilterCriteria(manager.createMapContainsKeyCriteria(Model.of(key), Model.<Boolean>of(true)));
queryModel.addFilterCriteriaManager(EMBEDDED_MAP_FIELD, manager);
assertTrue("size must be 1 but it is - " + queryModel.getObject().size(), queryModel.getObject().size() == 1);
}
use of ru.ydn.wicket.wicketorientdb.utils.query.filter.IFilterCriteriaManager in project wicket-orientdb by OrienteerBAP.
the class TestFilters method testRangeFilterCriteria.
@Test
public void testRangeFilterCriteria() {
List<Integer> models = Lists.newArrayList();
models.add(NUM_VALUE_1);
models.add(NUM_VALUE_3);
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 3, but it is - " + queryModel.size(), queryModel.size() == 3);
assertTrue(queryModel.getObject().get(0).field(NUMBER_FIELD).equals(NUM_VALUE_1));
assertTrue(queryModel.getObject().get(1).field(NUMBER_FIELD).equals(NUM_VALUE_2));
assertTrue(queryModel.getObject().get(2).field(NUMBER_FIELD).equals(NUM_VALUE_3));
}
use of ru.ydn.wicket.wicketorientdb.utils.query.filter.IFilterCriteriaManager in project wicket-orientdb by OrienteerBAP.
the class TestFilters method testLinkMapValue.
@Test
public void testLinkMapValue() {
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);
ODocument document = queryModel.getObject().get(0);
Map<String, ODocument> map = document.field(LINK_MAP_FIELD);
manager.clearFilterCriterias();
queryModel.detach();
manager.addFilterCriteria(manager.createMapContainsValueCriteria(Model.of(map.get(STR_VALUE_1)), Model.<Boolean>of(true)));
assertTrue("size must be 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 testEmbeddedMapValue.
@Test
public void testEmbeddedMapValue() {
IModel<OProperty> property = wicket.getProperty(EMBEDDED_MAP_FIELD);
IFilterCriteriaManager manager = new FilterCriteriaManager(property);
manager.addFilterCriteria(manager.createMapContainsValueCriteria(Model.of(STR_VALUE_1), Model.<Boolean>of(true)));
queryModel.addFilterCriteriaManager(EMBEDDED_MAP_FIELD, manager);
assertTrue("size must be 1 but it is - " + queryModel.getObject().size(), queryModel.getObject().size() == 1);
}
use of ru.ydn.wicket.wicketorientdb.utils.query.filter.IFilterCriteriaManager in project wicket-orientdb by OrienteerBAP.
the class TestFilters method testDateTimeCollection.
@Test
public void testDateTimeCollection() throws ParseException {
DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
List<Date> list = Lists.newArrayList();
list.add(format.parse(DATETIME_VALUE_1));
list.add(format.parse(DATETIME_VALUE_2));
IModel<OProperty> property = wicket.getProperty(DATETIME_FIELD);
IFilterCriteriaManager manager = new FilterCriteriaManager(property);
manager.addFilterCriteria(manager.createCollectionFilterCriteria(new CollectionModel<>(list), Model.of(true)));
queryModel.addFilterCriteriaManager(property.getObject().getName(), manager);
assertTrue(queryModel.getObject().size() == 2);
}
Aggregations