Search in sources :

Example 6 with FilterCriteriaManager

use of ru.ydn.wicket.wicketorientdb.utils.query.filter.FilterCriteriaManager 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);
}
Also used : IFilterCriteriaManager(ru.ydn.wicket.wicketorientdb.utils.query.filter.IFilterCriteriaManager) OProperty(com.orientechnologies.orient.core.metadata.schema.OProperty) SimpleDateFormat(java.text.SimpleDateFormat) DateFormat(java.text.DateFormat) IFilterCriteriaManager(ru.ydn.wicket.wicketorientdb.utils.query.filter.IFilterCriteriaManager) FilterCriteriaManager(ru.ydn.wicket.wicketorientdb.utils.query.filter.FilterCriteriaManager) SimpleDateFormat(java.text.SimpleDateFormat) Test(org.junit.Test)

Example 7 with FilterCriteriaManager

use of ru.ydn.wicket.wicketorientdb.utils.query.filter.FilterCriteriaManager 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);
}
Also used : IFilterCriteriaManager(ru.ydn.wicket.wicketorientdb.utils.query.filter.IFilterCriteriaManager) CollectionModel(org.apache.wicket.model.util.CollectionModel) IFilterCriteriaManager(ru.ydn.wicket.wicketorientdb.utils.query.filter.IFilterCriteriaManager) FilterCriteriaManager(ru.ydn.wicket.wicketorientdb.utils.query.filter.FilterCriteriaManager) IFilterCriteria(ru.ydn.wicket.wicketorientdb.utils.query.filter.IFilterCriteria) Test(org.junit.Test)

Example 8 with FilterCriteriaManager

use of ru.ydn.wicket.wicketorientdb.utils.query.filter.FilterCriteriaManager 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();
}
Also used : IFilterCriteriaManager(ru.ydn.wicket.wicketorientdb.utils.query.filter.IFilterCriteriaManager) IFilterCriteriaManager(ru.ydn.wicket.wicketorientdb.utils.query.filter.IFilterCriteriaManager) FilterCriteriaManager(ru.ydn.wicket.wicketorientdb.utils.query.filter.FilterCriteriaManager)

Example 9 with FilterCriteriaManager

use of ru.ydn.wicket.wicketorientdb.utils.query.filter.FilterCriteriaManager 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);
}
Also used : IFilterCriteriaManager(ru.ydn.wicket.wicketorientdb.utils.query.filter.IFilterCriteriaManager) IFilterCriteriaManager(ru.ydn.wicket.wicketorientdb.utils.query.filter.IFilterCriteriaManager) FilterCriteriaManager(ru.ydn.wicket.wicketorientdb.utils.query.filter.FilterCriteriaManager) IFilterCriteria(ru.ydn.wicket.wicketorientdb.utils.query.filter.IFilterCriteria) Test(org.junit.Test)

Example 10 with FilterCriteriaManager

use of ru.ydn.wicket.wicketorientdb.utils.query.filter.FilterCriteriaManager 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);
}
Also used : IFilterCriteriaManager(ru.ydn.wicket.wicketorientdb.utils.query.filter.IFilterCriteriaManager) OProperty(com.orientechnologies.orient.core.metadata.schema.OProperty) IFilterCriteriaManager(ru.ydn.wicket.wicketorientdb.utils.query.filter.IFilterCriteriaManager) FilterCriteriaManager(ru.ydn.wicket.wicketorientdb.utils.query.filter.FilterCriteriaManager) Test(org.junit.Test)

Aggregations

FilterCriteriaManager (ru.ydn.wicket.wicketorientdb.utils.query.filter.FilterCriteriaManager)24 IFilterCriteriaManager (ru.ydn.wicket.wicketorientdb.utils.query.filter.IFilterCriteriaManager)24 Test (org.junit.Test)23 OProperty (com.orientechnologies.orient.core.metadata.schema.OProperty)10 IFilterCriteria (ru.ydn.wicket.wicketorientdb.utils.query.filter.IFilterCriteria)10 CollectionModel (org.apache.wicket.model.util.CollectionModel)5 ODocument (com.orientechnologies.orient.core.record.impl.ODocument)4 DateFormat (java.text.DateFormat)3 SimpleDateFormat (java.text.SimpleDateFormat)3 ListModel (org.apache.wicket.model.util.ListModel)3 ODocumentModel (ru.ydn.wicket.wicketorientdb.model.ODocumentModel)2 ODocumentLinksQueryDataProvider (ru.ydn.wicket.wicketorientdb.model.ODocumentLinksQueryDataProvider)1 OQueryDataProvider (ru.ydn.wicket.wicketorientdb.model.OQueryDataProvider)1