Search in sources :

Example 6 with ODocumentModel

use of ru.ydn.wicket.wicketorientdb.model.ODocumentModel 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

Test (org.junit.Test)6 ODocumentModel (ru.ydn.wicket.wicketorientdb.model.ODocumentModel)6 ODocument (com.orientechnologies.orient.core.record.impl.ODocument)5 ORecordId (com.orientechnologies.orient.core.id.ORecordId)2 OProperty (com.orientechnologies.orient.core.metadata.schema.OProperty)2 FilterCriteriaManager (ru.ydn.wicket.wicketorientdb.utils.query.filter.FilterCriteriaManager)2 IFilterCriteria (ru.ydn.wicket.wicketorientdb.utils.query.filter.IFilterCriteria)2 IFilterCriteriaManager (ru.ydn.wicket.wicketorientdb.utils.query.filter.IFilterCriteriaManager)2 ODatabaseDocument (com.orientechnologies.orient.core.db.document.ODatabaseDocument)1 OClass (com.orientechnologies.orient.core.metadata.schema.OClass)1 ODocumentLinksDataProvider (ru.ydn.wicket.wicketorientdb.model.ODocumentLinksDataProvider)1 ODocumentLinksQueryDataProvider (ru.ydn.wicket.wicketorientdb.model.ODocumentLinksQueryDataProvider)1 OPropertyModel (ru.ydn.wicket.wicketorientdb.model.OPropertyModel)1 OQueryModel (ru.ydn.wicket.wicketorientdb.model.OQueryModel)1