Search in sources :

Example 1 with ODocumentLinksQueryDataProvider

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

Aggregations

OProperty (com.orientechnologies.orient.core.metadata.schema.OProperty)1 ODocument (com.orientechnologies.orient.core.record.impl.ODocument)1 Test (org.junit.Test)1 ODocumentLinksQueryDataProvider (ru.ydn.wicket.wicketorientdb.model.ODocumentLinksQueryDataProvider)1 ODocumentModel (ru.ydn.wicket.wicketorientdb.model.ODocumentModel)1 FilterCriteriaManager (ru.ydn.wicket.wicketorientdb.utils.query.filter.FilterCriteriaManager)1 IFilterCriteria (ru.ydn.wicket.wicketorientdb.utils.query.filter.IFilterCriteria)1 IFilterCriteriaManager (ru.ydn.wicket.wicketorientdb.utils.query.filter.IFilterCriteriaManager)1