Search in sources :

Example 11 with IFilterCriteria

use of ru.ydn.wicket.wicketorientdb.utils.query.filter.IFilterCriteria in project wicket-orientdb by OrienteerBAP.

the class TestFilters method testEqualsFilterCriteria.

@Test
@SuppressWarnings("unchecked")
public void testEqualsFilterCriteria() {
    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);
    assertTrue(queryModel.getObject().size() == 1);
    assertTrue(queryModel.getObject().get(0).field(NUMBER_FIELD).equals(NUM_VALUE_1));
    queryModel.detach();
    manager = new FilterCriteriaManager(wicket.getProperty(STRING_FIELD));
    equalsFilterCriteria = manager.createEqualsFilterCriteria(Model.of(STR_VALUE_1), Model.of(true));
    manager.addFilterCriteria(equalsFilterCriteria);
    String strField = wicket.getProperty(STRING_FIELD).getObject().getName();
    queryModel.addFilterCriteriaManager(strField, manager);
    assertTrue(queryModel.getObject().size() == 1);
    assertTrue(queryModel.getObject().get(0).field(STRING_FIELD).equals(STR_VALUE_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)

Aggregations

IFilterCriteria (ru.ydn.wicket.wicketorientdb.utils.query.filter.IFilterCriteria)11 Test (org.junit.Test)10 FilterCriteriaManager (ru.ydn.wicket.wicketorientdb.utils.query.filter.FilterCriteriaManager)10 IFilterCriteriaManager (ru.ydn.wicket.wicketorientdb.utils.query.filter.IFilterCriteriaManager)10 ODocument (com.orientechnologies.orient.core.record.impl.ODocument)3 CollectionModel (org.apache.wicket.model.util.CollectionModel)3 OProperty (com.orientechnologies.orient.core.metadata.schema.OProperty)2 ODocumentModel (ru.ydn.wicket.wicketorientdb.model.ODocumentModel)2 Serializable (java.io.Serializable)1 List (java.util.List)1 ODocumentLinksQueryDataProvider (ru.ydn.wicket.wicketorientdb.model.ODocumentLinksQueryDataProvider)1 OQueryDataProvider (ru.ydn.wicket.wicketorientdb.model.OQueryDataProvider)1 FilterCriteriaType (ru.ydn.wicket.wicketorientdb.utils.query.filter.FilterCriteriaType)1